Postgres time Conversion Function

Source: Internet
Author: User
Function Return type Description Example
To_char(Timestamp,Text) Text Converts a timestamp to a string. To_char (current_timestamp, 'hh12: MI: ss ')
To_char(Interval,Text) Text Convert the time interval into a string To_char (interval '15h 2 m 12s', 'hh24: MI: ss ')
To_char(Int,Text) Text Converts an integer to a string. To_char (125, '123 ')
To_char(Double Precision,Text) Text Convert real numbers/double-precision numbers into strings To_char (125.8: Real, '999d9 ')
To_char(Numeric,Text) Text Converts numeric to a string. To_char (-125.8, '999d99s ')
To_date(Text,Text) Date Converts a string to a date. To_date ('05 Dec 2000 ', 'dd mon yyyy ')
To_timestamp(Text,Text) Timestamp with Time Zone Converts a string to a timestamp. To_timestamp ('05 Dec 2000 ', 'dd mon yyyy ')
To_timestamp(Double Precision) Timestamp with Time Zone Converts a Unix epoch to a timestamp. To_timestamp (200120400)
To_number(Text,Text) Numeric Convert string to numeric To_number ('1970-', '99g999d9s ')

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.