This is an automated email from the ASF dual-hosted git repository.

leonard pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 99b5041a98366100467eb27c73ede2aa93f35bab
Author: Hang Ruan <ruanhang1...@hotmail.com>
AuthorDate: Mon Mar 13 16:51:59 2023 +0800

    [FLINK-30959][table][docs] Improve the documentation of UNIX_TIMESTAMP 
function for different argument formats
---
 docs/data/sql_functions.yml | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/docs/data/sql_functions.yml b/docs/data/sql_functions.yml
index bce78e1d78e..102d2ed2f52 100644
--- a/docs/data/sql_functions.yml
+++ b/docs/data/sql_functions.yml
@@ -499,7 +499,24 @@ temporal:
     description: Gets current Unix timestamp in seconds. This function is not 
deterministic which means the value would be recalculated for each record.
   - sql: UNIX_TIMESTAMP(string1[, string2])
     table: unixTimestamp(STRING1[, STRING2])
-    description: 'Converts date time string string1 in format string2 (by 
default: yyyy-MM-dd HH:mm:ss if not specified) to Unix timestamp (in seconds), 
using the specified timezone in table config.'
+    description: |
+      Converts a date time string string1 with format string2 (by default: 
yyyy-MM-dd HH:mm:ss if not specified) to Unix timestamp (in seconds), using the 
specified timezone in table config.
+      
+      If a time zone is specified in the date time string and parsed by UTC+X 
format such as "yyyy-MM-dd HH:mm:ss.SSS X", this function will use the 
specified timezone in the date time string instead of the timezone in table 
config.
+      If the date time string can not be parsed, the default value 
Long.MIN_VALUE(-9223372036854775808) will be returned.
+      
+      ```
+      SET 'table.local-time-zone' = 'Europe/Berlin';
+      
+      -- 1641020400
+      SELECT UNIX_TIMESTAMP('2022-01-01 08:00:00.001', 'yyyy-MM-dd 
HH:mm:ss.SSS');
+      -- 1640995200
+      SELECT UNIX_TIMESTAMP('2022-01-01 08:00:00.001 +0800', 'yyyy-MM-dd 
HH:mm:ss.SSS X');
+      -- 1641020400
+      SELECT UNIX_TIMESTAMP('2022-01-01 08:00:00.001 +0800', 'yyyy-MM-dd 
HH:mm:ss.SSS');
+      -- -9223372036854775808
+      SELECT UNIX_TIMESTAMP('2022-01-01 08:00:00.001', 'yyyy-MM-dd 
HH:mm:ss.SSS X');
+      ```
   - sql: TO_DATE(string1[, string2])
     table: toDate(STRING1[, STRING2])
     description: Converts a date string string1 with format string2 (by 
default 'yyyy-MM-dd') to a date.

Reply via email to