नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
Applies to:
Databricks SQL
Databricks Runtime
Returns the timestamp in expr as a UNIX timestamp.
Syntax
to_unix_timestamp(expr [, fmt] )
Arguments
expr: A STRING expression representing a timestamp.- fmt: An optional format STRING expression.
Returns
A BIGINT.
If fmt is supplied, it must conform with Datetime patterns.
If fmt is not supplied, the function is a synonym for cast(expr AS TIMESTAMP).
If fmt is malformed or its application does not result in a well formed timestamp, the function raises an error.
Note
In Databricks Runtime, if spark.sql.ansi.enabled is false, the function returns NULL instead of an error for malformed timestamps.
Examples
> SELECT to_unix_timestamp('2016-04-08', 'yyyy-MM-dd');
1460098800