DOW( ) function

Returns a numeric value (1 to 7) representing the day of the week for a specified date or datetime. Abbreviation for “Day of Week”.

Syntax

DOW(date/datetime)

Parameters

date/datetime

Datetime. The field, expression, or literal value to return the numeric day of the week for.

Output

Numeric.

Remarks

You can use the DOW( ) function to determine which day of the week a date falls on, and return a numeric value between 1 (Sunday) and 7 (Saturday) representing the day of the week.

Use the CDOW( ) function if you want to return the name of the day of the week. Use the DAY( ) function if you want to return the day of the month as a number (1 to 31).

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

When specifying a literal date or datetime value for the date/datetime parameter, you are restricted to the formats in the table below, and you must enclose the value in backquotes – for example, `20141231`. For datetime values, you can use any combination of date, separator, and time formats. The date must precede the time, and you must use a separator between the two. Times must be specified using the 24-hour clock. Offsets from Coordinated Universal Time (UTC) must be prefaced by a plus sign (+) or a minus sign (-). Do not use any separators such as slashes (/) or colons (:) between the individual components of dates or times.

Date formats

Separator formats

Time formats

Examples

YYYYMMDD

single blank space

hhmmss

`20141231`

YYMMDD

the letter ‘t’

hhmm

`20141231 235959`

the letter ‘T’

hh

`141231 2359`

 

+/-hhmm

(UTC offset)

`141231t23`

+/-hh

(UTC offset)

`141231t235959-0500`

(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.)

`141231T2359+01`

Examples

Example Return value

DOW(`20141231`)

4

December 31, 2014 falls on a Wednesday, the 4th day of the week.

DOW(`20141231 235959`)

4

December 31, 2014 falls on a Wednesday, the 4th day of the week.

DOW(Invoice_date)

The numeric day of the week for each value in the Invoice_date field

DOW(Receipt_timestamp)

The numeric day of the week for each value in the Receipt_timestamp field

Identify transactions occurring on a weekend

You can use the DOW( ) function to identify transactions that occur on a weekend. The filter below isolates dates in the Trans_Date field that occur on a Saturday or a Sunday.

SET FILTER TO DOW(Trans_Date) = 7 OR DOW(Trans_Date) = 1
Related reference
CDOW( ) function
DAY( ) function


(C) 2015 ACL Services Ltd. All Rights Reserved.