Devart ODBC Driver for PostgreSQL supports the following formatting functions for converting between textual and typed representations of dates, times, timestamps, intervals, and numbers.
All functions use PostgreSQL format models (for example, HH12:MI:SS, DD Mon YYYY, 999D99S).
| Function | Return type | Description |
|---|---|---|
to_char(timestamp, text) |
text |
Converts a timestamp value to a string using the specified format model (for example, time, date, or combined date-time patterns). |
to_char(timestamp with time zone, text) |
text |
Converts a timestamp with time zone value to a string using the specified format model, taking the time zone into account. |
to_char(interval, text) |
text |
Converts an interval (duration) to a string using the specified format model (for example, HH24:MI:SS for hours, minutes, and seconds). |
to_char(numeric_type, text) |
text |
Converts a numeric value (such as integer, bigint, or numeric) to a string using the specified numeric format model, including optional grouping separators, decimal symbols, and sign formatting. |
to_date(text, text) |
date |
Parses a string and converts it to a date value according to the specified date format model. |
to_number(text, text) |
numeric |
Parses a string and converts it to a numeric value according to the specified numeric format model, including support for grouping (G) and decimal (D) symbols. |
to_timestamp(text, text) |
timestamp with time zone |
Parses a string and converts it to a timestamp with time zone value according to the specified timestamp format model. |