This topic describes the syntax, features, parameters, and return values of time functions and provides examples of these functions.
Click a function name to get detailed information:
today | time | now | localtime | utctime | cookie_time | http_time | parse_http_time | unixtime
today
Item | Description |
Syntax |
|
Parameter | N/A |
Feature | Queries the current date in the format of yyyy-mm-dd. |
Return value | |
Example | Output: |
time
Item | Description |
Syntax |
|
Parameter | N/A |
Feature | Queries the current UNIX timestamp, excluding the fractional part of milliseconds. Unit: seconds. |
Return value | |
Example | Output: |
now
Item | Description |
Syntax |
|
Parameter | N/A |
Feature | Queries the current UNIX timestamp, including the fractional part of milliseconds. Unit: seconds. |
Return value | |
Example | Output: |
localtime
Item | Description |
Syntax |
|
Parameter | N/A |
Feature | Queries the current date and time in the format of yyyy-mm-dd hh:mm:ss. |
Return value | |
Example | Output: |
utctime
Item | Description |
Syntax |
|
Parameter | N/A |
Feature | Queries the current UTC time in the format of yyyy-mm-dd hh:mm:ss. |
Return value | |
Example | Output: |
cookie_time
Item | Description |
Syntax |
|
Parameter | sec: a UNIX timestamp. To query the UNIX timestamp, you can call the |
Feature | Generates a time string that can be used in cookies based on the UNIX timestamp specified by the |
Return value | |
Example | Output: |
http_time
Item | Description |
Syntax |
|
Parameter | sec: a UNIX timestamp. To query the UNIX timestamp, you can call the |
Feature | Generates a time string that can be used in HTTP headers. For example, a time string that can be used in the Last-Modified header. |
Return value | A time string that can be used in HTTP headers based on the UNIX timestamp specified by the |
Example | Output |
parse_http_time
Item | Description |
Syntax |
|
Parameter | str: the time string that you want to parse. Example: |
Feature | Parses a time string that can be used in HTTP headers and returns the corresponding UNIX timestamp. |
Return value | If the function succeeds, a UNIX timestamp is returned. If the function fails, |
Example | Output |
unixtime
Item | Description |
Syntax |
|
Parameter |
|
Feature | Generates and returns a UNIX timestamp based on the provided values of the year, month, day, hour, min, and sec parameters. |
Return value | |
Example | Output |