Here’s how to use datetime() function.
Description:
Adjust the precision of the datetime expression and return it.
Syntax:
datetime(dt)
Note:
The function adjusts and returns the precision of a specified datetime value. By default, the precision is the day.
Parameter:
dt |
Datetime value. |
Option:
@m |
Accurate to minute. |
@s |
Accurate to second. |
@h |
Accurate to hour. |
Return value:
Datetime value
Example:
|
A |
|
1 |
=datetime(now()) |
2013-12-09 00:00:00 |
2 |
=datetime@m(now()) |
2013-12-09 16:56:00 |
3 |
=datetime@s(now()) |
2013-12-09 16:56:45 |
4 |
=datetime@h(now()) |
2013-12-09 16:00:00 |
Related functions:
Description:
Convert a string or long integer to datetime value.
Syntax:
datetime(s) |
Convert string s into datetime value according to system-defined datetime format; return null if the conversion fails. |
datetime(s, fmt:loc) |
Convert string s to datetime type according to the format defined by parameter fmt and return null if the conversion fails; When parameter fmt is absent, the format of string s should be the same as that of the datetime value in configuration information; parameter loc is the language, whose default is the system language. |
datetime(l) |
Convert long integer type to datetime. |
datetime(d,t) |
Concatenate date d and time t into a datetime. |
datetime(y,m,d,h,m,s) |
Convert y,m,d,h,m,s of integer type to datetime data. |
Note:
The format of the specified string should match the datetime format.
The datetime format in the conversion result should be consistent with that specified in the configuration file. Click Options -> Environment -> Datetime Format in IDE to perform the settings. When esProc is integrated into a third-party application, set up the date format in raqsoftConfig.xml’s dateTimeFormat node.
Parameter:
s |
String. |
fmt |
Format string. |
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. |
l |
Long integer counted in microseconds. |
d |
Date type. |
t |
Time type. |
y |
Positive integer, year. |
m |
Positive integer, month. |
d |
Positive integer, day. |
h |
Positive integer, hour. |
m |
Positive integer, minute. |
s |
Positive integer, second. |
Return value:
Datetime
Example:
|
A |
|
1 |
=datetime("2006-01-01 10:20:30") |
2006-01-01 10:20:30 |
2 |
=datetime("12/28/1972 10:23:43","MM/dd/yyyy HH:mm:ss") |
1972-12-28 10:23:43 |
3 |
=datetime("2006-01-01 10:20:30:111") |
2006-01-01 10:20:30 |
4 |
=datetime(12345) |
1970-01-01 08:00:12 |
5 |
=datetime(date("1982-08-09"),time("12:12:12")) |
1982-08-09 12:12:12 |
6 |
=datetime(2006,01,01,-10,-20,30) |
2005-12-31 13:40:30 |
7 |
=datetime("4 五月 2001 3:08 下午","d MMM yyyy h:mm a":"zh") |
2001-05-04 15:08:00 |
Related function: