Briefly describe the time domain function of the data warehouse

This article is shared from the HUAWEI CLOUD community "​​​​​​ GaussDB (DWS) Time Domain Function ​​​​​​​, author: Add up.

1. What are time domain functions and what are they?

The time domain function refers to the function that obtains the value of each part of the timestamp in the database. The existing time domain functions include:
 1) quarter function: get the quarter
 2) hour function: get the hour
 3) minute function: get the minute
 4) second function: get the second
 5) microsecond function: get the microsecond.

2. Analysis of time domain function parameters

There are four types of input parameters for time domain functions, including:
  1) date type
  2) timestamp/timestamptz type
  3) time/timetz type
  4) text type. Input of type text will be converted to the corresponding date, timestamp/timestamptz or time type according to the input format.

       date        Timestamp/timestamptz Time/timetz text
quarter ×
hour √ (default is 0)
minute √ (default is 0)
second √ (default is 0)
microsecond √ (default is 0)

                 Time domain function input parameter support type table

Parameter parsing supports time zone setting. When the input parameter contains a time zone, the result will be converted to the current time zone. In the following use case, the default time zone of the database is the +08:00 time zone.

3. Results display

4. Summary

  The time domain function is a function added to obtain the value of each part of the timestamp. It supports the parsing of text type input parameters, so that the text type input parameters are implicitly converted, and the parsing becomes the corresponding timestamp type to obtain the target value, which is closer to the actual scene.

If you want to know more about GuassDB (DWS), please search "GaussDB DWS" on WeChat and follow the WeChat public account, and share with you the latest and most complete PB-series data warehouse black technology, and you can also get a lot of learning materials in the background~

Click Follow to learn about HUAWEI CLOUD's new technologies for the first time~​

Guess you like

Origin blog.csdn.net/devcloud/article/details/124469366