unix_timestamp
The unix_timestamp function is used to convert a date value to a numeric UNIX format date value.
The function returns the first ten digits of a normal UNIX format timestamp.
Syntax
unix_timestamp(string timestamp, string pattern)
Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| timestamp | No | DATE or STRING | The date value to be converted. Formats:
|
| pattern | No | STRING | The target format. When pattern is empty, the default format is yyyy-mm-dd hh:mi:ss. The format is a combination of time units representing year, month, day, hour, minute, and second, along with any characters.
|
Return Values
Returns a value of type BIGINT.
- If the timestamp value is NULL, NULL is returned.
- When both timestamp and pattern are empty, the timestamp representing the number of seconds from 1970-01-01 00:00:00 to the present is returned.
Example Code
- Returns 1692149997.
select unix_timestamp('2023-08-16 09:39:57') - Assuming the current system time is 2023-08-16 10:23:16, returns 1692152596.
select unix_timestamp();
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot