CDOW( ) function

Returns the name of the day of the week for a specified date or datetime. Abbreviation for "Character Day of Week".

Syntax

CDOW(date/datetime, length)

Parameters

Name Type Description
date/datetime

datetime

The field, expression, or literal value to return the day name for.
length

numeric

A value between 1 and 9 that specifies the length of the output string. To display abbreviated day names, specify a smaller value.

Output

Character.

Examples

Basic examples

Returns "Wednesday" because December 31, 2014 falls on a Wednesday, and length is 9:

CDOW(`20141231`, 9)

Returns "Wed" because December 31, 2014 falls on a Wednesday, and length is 3:

CDOW(`20141231 235959`, 3)

Returns the full day name for each value in the Invoice_date field:

CDOW(Invoice_date, 9)

Returns the abbreviated day name for each value in the Receipt_timestamp field:

CDOW(Receipt_timestamp, 3)

Advanced examples

Adding a field that identifies the days of the week for dates

Use the CDOW( ) function to create a computed field that identifies the days of the week for all the dates in a date field. Once you have created the computed field, you can add it to the view beside the date column:

DEFINE FIELD Name_of_Day COMPUTED CDOW(Trans_Date, 3)

Creating a filter to test for transactions that occurred on a weekend

Use the CDOW( ) function to create a filter that isolates transactions that occurred on a weekend:

SET FILTER TO CDOW(Trans_Date, 3) = "Sat" OR CDOW(Trans_Date, 3) = "Sun"

Remarks

Parameter details

A field specified for date/datetime can use any date or datetime format, as long as the field definition correctly defines the format.

If the length parameter is shorter than the day name, the day name is truncated to the specified length. If the length parameter is longer than the day name, the day name is padded with blank spaces.

Specifying a literal date or datetime value

When specifying a literal date or datetime value for date/datetime, you are restricted to the formats in the table below, and you must enclose the value in backquotes – for example, `20141231`.

Do not use any separators such as slashes (/) or colons (:) between the individual components of dates or times.

  • Datetime values – you can use any combination of the date, separator, and time formats listed in the table below. The date must precede the time, and you must use a separator between the two. Valid separators are a single blank space, the letter 't', or the letter 'T'.

  • Time values – you must specify times using the 24-hour clock. Offsets from Coordinated Universal Time (UTC) must be prefaced by a plus sign (+) or a minus sign (-).

    Example formats

    Example literal values

    YYYYMMDD

    `20141231`

    YYMMDD

    `141231`

    YYYYMMDD hhmmss

    `20141231 235959`

    YYMMDDthhmm

    `141231t2359`

    YYYYMMDDThh

    `20141231T23`

    YYYYMMDD hhmmss+/-hhmm

    (UTC offset)

    `20141231 235959-0500`

    YYMMDD hhmm+/-hh

    (UTC offset)

    `141231 2359+01`

    Note

    Do not use hh alone in the main time format with data that has a UTC offset. For example, avoid: hh+hhmm. Results can be unreliable.

     

Related functions

If you need to return the day of the week as a number (1 to 7), use DOW( ) instead of CDOW( ).

ACL Scripting Guide 14.1