postgreSQL中含有PM/AM时间格式转换to_timestamp

前端之家收集整理的这篇文章主要介绍了postgreSQL中含有PM/AM时间格式转换to_timestamp前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Postgresql帮助文档

9.8. Data Type Formatting Functions
The Postgresqlformatting functionsprovide a powerful set of tools for converting varIoUs data types(date/time,integer,floating point,numeric)to formatted strings and forconverting from formattedstringstospecific data types.

GPSData=#selectto_timestamp('Sep 28 201010:51:46:163PM','Mon DD YYYYHH24:MI:SS:MS');

to_timestamp

----------------------------

2010-09-2822:51:46.163+08

(1行记录)

GPSData=#selectto_timestamp('Sep 28 201010:51:46:163AM','Mon DD YYYYHH24:MI:SS:MSAM');

2010-09-2810:51:46.163+08

)

GPSData=#select to_timestamp('Sep 28 201010:51:46:163PM','Mon DD YYYYHH12:MI:SS:MSPM');

to_timestamp

----------------------------

2010-09-2822:51:46.163+08

(1行记录)

to_timestamp('Sep 28 2010AM','Mon DD YYYYHH12:MI:SS:MSAM');

10:51:46.163+08

)

原文链接:https://www.f2er.com/postgresql/195200.html

猜你在找的Postgre SQL相关文章