![]() ![]() With a Spanish locale setting this produces "Sábado, 12 de Agosto del año 2016". it converts the string to a value with the default timezone and then applies conversion from a local time zone to the 'Etc/UTC'. SELECT to_char(' 16:40:32'::timestamp, 'TMDay, DD" de "TMMonth" del año "YYYY') SELECT totimestamp (field1, 'YYYY-MM-DD hh24:mi:ss')::timestamp without time zone at time zone 'Etc/UTC'. This option uses the localization setting of the server running PostgreSQL or the client connecting to it. You can localize the string to your language of choice (day and month names) by using the TM (translation mode) modifier. As a safety measure, you should put all plain text in double quotes, as done above. The PostgreSQL formatting functions provide a powerful set of tools for converting various data types (date/time, integer, floating point, numeric) to formatted strings and for converting from formatted strings to specific data types. You should keep in mind, though, that any template patterns - even the single letter ones like "I", "D", "W" - are converted, unless the plain text is in double quotes. This will produce the string "Today is Saturday, the 12th day of the month of August of 2016". '"Today is "FMDay", the "DDth" day of the month of "FMMonth" of "YYYY') Note that you can also insert plain text into the formatting string and you can use the template patterns in any order: SELECT to_char(' 16:40:32'::timestamp, These functions all follow a common calling convention. The formatting string can be modified in many different ways the full list of template patterns can be found here. The PostgreSQL formatting functions provide a powerful set of tools for converting various data types (date/time, integer, floating point, numeric) to formatted strings and for converting from formatted strings to specific data types. This statement will produce the string " 04:40:32PM". You can convert a timestamp or interval value to a string with the to_char() function: SELECT to_char(' 16:40:32'::timestamp, 'DD Mon YYYY HH:MI:SSPM')
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |