Description:
Convert a string or integers to date type data.
Syntax:
date(stringExp) Format of result returned by stringExp should be consistent with the application default date format "yyyy-MM-dd"; if the string contains a time part, the time will not be converted.
date(year,month,day) Convert integers year, month and day to date type data.
date(stringExp,format:loc) Convert stringExp to a date according to the specified format; parameter loc is the language stringExp uses; use the system default language when loc is absent.
date(datetimeExp) Get the date part from datetime data.
date(ym,day) Convert integers ym and day to date type data.
Parameter:
|
stringExp |
A string expression. |
|
format |
A format string. |
|
loc |
Language name, which is case-insensitive; the most commonly-used languages are Chinese (zh) and English (en) . |
|
year |
An integer. |
|
month |
An integer. |
|
day |
An integer. |
|
datetimeExp |
Datetime data. |
|
ym |
A 6-digit integer, which is the YearMonth. |
|
day |
An integer. |
Return value:
Date type
Example:
Example 1: date("1982-08-09") Return date 1982-08-09
Example 2: date("1982-08-09 10:20:30") Return date 1982-08-09
Example 3: date(1982,18,09) Return date 1983-06-09
Example 4: date(1982,08,09) Return date 1982-08-09
Example 5: date(1982,-8,09) Return date 1981-04-09
Example 6: date(now()) Return date 2016-09-22
Example 7: date("12/28/1972","MM/dd/yyyy") Return date 1972-12-28
Example 8: date(189208,08) Return date 1892-08-08
Example 9: date("4 Jul 2001","d MMM yyyy":"en") Return date 2001-07-04