Description:
Convert a string, an integer, or a long integer to a date value.
Syntax:
date(stringExp,format:loc) |
Convert stringExp to a date value according to the format defined by format and return null if the conversion fails; parameter loc is the language used in stringExp; the default is the system language |
date(stringExp) |
The format of the result returned by stringExp should be in consistent with the date format in configuration information; if time is contained in the result, the time will not be converted; return null if the conversion fails |
date(year,month,day) |
Convert year,month,day of integer type to date type; return null if the conversion fails |
date(ym,day) |
Convert integer ym and day into date data |
date(longExp) |
Convert long integer longExp to date type data |
date@o(day) |
Convert integer type day to date type data; parameter day can be regarded as the value of computing days@o() |
Note:
The function converts string stringExp, integer year,month,day or long integer longExp to date type data.
Parameter:
format |
Format string |
stringExp |
String expression |
loc |
Language name, which is case insensitive. The most commonly used languages are Chinese (zh) and English (en); see A.sort() to know other languages supported in esProc |
year |
Integer |
month |
Integer |
day |
Integer |
ym |
6-bit integer interpreted as year and month |
longExp |
64-bit loing integer |
Return value:
Date type data
Example:
|
A |
|
1 |
=date("1982-08-09") |
1982-08-09 |
2 |
=date("1982-08-09 10:20:30") |
1982-08-09 |
3 |
=date(1982,08,09) |
1982-08-09 |
4 |
=date(1982,-8,09) |
1981-04-09 |
5 |
=date(1982,18,09) |
6/9/1983 |
6 |
=date("12/28/1972"," MM/dd/yyyy ") |
1972-12-28 |
7 |
=date(189208,08) |
1892-08-08 |
8 |
=date("4 Jul 2001","d MMM yyyy":"en") |
2001-07-04 |
9 |
=date(792172800000) |
1995-02-08 |
10 |
=date@o(150) |
1970-05-22 |
Related function: