Provides the syntax, parameters, return values, and examples of time functions.
today
| Item | Description |
| Syntax | today() |
| Description | Returns the current date in local time. Format: yyyy-mm-dd. |
| Parameters | None |
| Return value | Returns the current date. Format: yyyy-mm-dd. |
| Examples | Output: |
time
| Item | Description |
| Syntax | time() |
| Description | Returns the current UNIX timestamp in seconds, excluding fractional milliseconds. Note The UNIX timestamp is independent of time zones and represents the number of seconds elapsed since 00:00:00 (UTC) on January 1, 1970. |
| Parameters | None. |
| Return value | Returns the current UNIX timestamp. |
| Examples | Output: |
now
| Item | Description |
| Syntax | now() |
| Description | Returns the current UNIX timestamp in seconds, excluding fractional milliseconds. Note The UNIX timestamp is independent of time zones and represents the number of seconds elapsed since 00:00:00 (UTC) on January 1, 1970. |
| Parameters | None. |
| Return value | Returns the current UNIX timestamp in seconds, excluding fractional milliseconds. |
| Examples | The following result is returned: |
localtime
| Item | Description |
| Syntax | localtime() |
| Description | Returns the current date and time in local time. Format: yyyy-mm-dd hh:mm:ss. |
| Parameters | None. |
| Return value | Returns the current date and time. Format: yyyy-mm-dd hh:mm:ss. |
| Examples | Output: |
utctime
| Item | Description |
| Syntax | utctime() |
| Description | Returns the current UTC date and time. Format: yyyy-mm-dd hh:mm:ss. |
| Parameters | None. |
| Return value | Returns the current UTC date and time. Format: yyyy-mm-dd hh:mm:ss. |
| Examples | Output: |
cookie_time
| Item | Description |
| Syntax | cookie_time(sec) |
| Description | Converts a UNIX timestamp to a GMT time string in cookie format. |
| Parameters | sec: the UNIX timestamp to convert. You can call the time() function to obtain a UNIX timestamp. |
| Return value | Returns a cookie-format time string based on the UNIX timestamp specified by the sec parameter. |
| Examples | Output: |
http_time
| Item | Description |
| Syntax | http_time(sec) |
| Description | Converts a UNIX timestamp to a GMT time string for use in HTTP headers, such as Last-Modified. Important The generated time strings are in GMT. |
| Parameters | sec: the UNIX timestamp to convert. You can call the time() function to obtain a UNIX timestamp. |
| Return value | Returns an HTTP header-format time string based on the UNIX timestamp specified by the sec parameter. |
| Examples | Output: |
parse_http_time
| Item | Description |
| Syntax | parse_http_time(str) |
| Description | Parses an HTTP header time string and returns the corresponding UNIX timestamp. Important This function does not recognize time zones. Convert local time to GMT before passing it to this function. |
| Parameters | str: the HTTP header time string to parse. Example: Wed, 29 May 2019 06:02:41 GMT. You can call the http_time() function to generate this string. |
| Return value | If the function succeeds, the corresponding UNIX timestamp is returned. Otherwise, false is returned. |
| Examples | Output: |
unixtime
| Item | Description |
| Syntax | unixtime(year, month, day, hour, min, sec) |
| Description | Converts the specified date and time to a UNIX timestamp. Note The UNIX timestamp is independent of time zones and represents the number of seconds elapsed since 00:00:00 (UTC) on January 1, 1970. |
| Parameters |
|
| Return value | Returns a UNIX timestamp. |
| Examples |
|