7.1
2013-09-23

DATE

Windows

Syntax

DATE(Input date string[,Date string format])

Description

Returns the current date, formatted according to <Date string format> (optional) or the system regional settings.

Example

DATE(database field, "DD MMMM YYYY") or DATE("19740227", "").

Parameter description

Input date string

Date in "YYYYMMDD" format (Example: 20070206).

Date string format

Enter the output date format. Use the D, M and Y symbols to represent the date.

You can use the following parameters for "date string format":

d

Number of the day, no leading zero

1

dd

Number of the day, with leading zero

01

ddd

Short weekday name

Mon

dddd

Long weekday name

Monday

 

 

 

m

Number of the month, no leading zero

6

mm

Number of the month, with leading zero

06

mmm

Short month name

Jun

mmmm

Long month name

June

 

 

 

yy

Short year notation

01

yyy

Long year notation

2001

Mac OS

It is possible to specify the format of the expression with format specifiers as shown below. These can be used with the DATE and the TODAY function.

Format Specifier

Result

%%

A"%" character

%a

Abbreviated weekday name

%A

Full weekday name

%b

Abbreviated month name

%B

Full month name

%c

Shorthand for "%X %x", the locale format for date and time

%d

Day of the month as a decimal number (01-31)

%e

Same as %d but does not print the leading 0 for days 1 through 9 (unlike strftime(), does not print a leading space)

%F

Milliseconds as a decimal number (000-999)

%H

Hour based on a 24-hour clock as a decimal number (00-23)

%I

Hour based on a 12-hour clock as a decimal number (01-12)

%j

Day of the year as a decimal number (001-366)

%m

Month as a decimal number (01-12)

%M

Minute as a decimal number (00-59)

%p

AM/PM designation for the locale

%S

Second as a decimal number (00-59)

%w

Weekday as a decimal number (0-6), where Sunday is 0

%x

Date using the date representation for the locale, including the time zone (produces different results from strftime())

%X

Time using the time representation for the locale (produces different results from strftime())

%y

Year without century (00-99)

%Y

Year with century (such as 1990)

%Z

Time zone name (such as Pacific Daylight Time; produces different results from strftime())

%z

Time zone offset in hours and minutes from GMT (HHMM)

Examples:

You can use the format specifier to generate different results.

DATE() - Yields a date according to the specified format or according to the date preferences (specify format:"")

DATE("20020701", "") => 2002-07-01 00:00:00 +0000

DATE("20020701","%m-%d-%y") => 07-01-02

DATE("20020701","%m-%d-%y") will give 07-01-02

DATE("20020701","%b-%A-%Y") will give Jul-Monday-2002

DATE("20020701","%B-%w-%Y") will give july-1-2002

TODAY() - Yields today's date according to the specified format or according to the date preferences (if format="")

TODAY("") => "2002-11-07 12:40:10 +0100"

TODAY("%A %d-%m-%Y %H:%M:%S") => Thursday 07-11-2002 12:40:10