User Tools

Site Tools


syntax:functions:date

This is an old revision of the document!


Date(date_as_text, format)

Category: Date and Time function


Description

This function converts date_as_text into a date represented as a number according to format string.


Arguments

ArgumentTypeDescription
date_as_text Text The text value, representing a date, to be converted into a date serial number.
format Text The layout of the date_as_text value describing the order and type of components. See the "Format string components" table below.

Return value type: Number (date serial value).


Format string components

The components below are case-sensitive.

Character Description
d The day of the month, from 1 through 31.
dd The day of the month, from 01 through 31.
ddd The abbreviated name of the day of the week.
M The month, from 1 through 12.
MM The month, from 01 through 12.
MMM The abbreviated name of the month.
MMMM The full name of the month.
y The year, from 0 to 99.
yy The year, from 00 to 99.
yyyy The year as a four-digit number.


Remarks

This function returns the date serial number of the date input, but displays it as a readable date. For example, January 1st, 2014 is represented as 41640 numerically. EasyMoprh then displays this value as a readable date: 01-Jan-2014. Under the hood, the actual value is 41640.

To see the date serial number in a column of dates, right-click the column's heading and select "Filter/Profile". In the Filter/Profile window, select the "Metadata" tab. In the "Number format" drop-down, select the "1000" format to have the date serial number display in the column instead of the formatted date. Switch back to one of the date formats to view the values as a date.


Examples

date('20140101', 'yyyyMMdd') = 41640  //Displays as 01-Jan-2014
date('14-01-01', 'yy-MM-dd') = 41640  //Displays as 01-Jan-2014
date('30/12/2000', 'dd/MM/yyyy') = 44556  //Displays as 30-Dec-2000
date('20140101','yy-MM-dd') = #Can't convert to date


See also

syntax/functions/date.1627708223.txt.gz · Last modified: 2021/07/31 01:10 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki