我真的不明白这个...
下面的第一条语句返回预期的行 - 只有日期早于/小于...的行
select matchdate, price, size, issell from matchmsg
where matchdate <= '2015-01-17 00:00:00.000000+01' order by matchdate asc
下面的代码返回日期为 2015-01-21...!?
select matchdate, price, size, issell from matchmsg
where matchdate <= 'Sat Jan 17 2015 00:00:00 GMT+0100' order by matchdate asc
PS:我使用 PostgresSQL、NodeJS 和 NPM Moment...但结果来自 PostgreSQL 工具 pgAminIII...所以 - 它与我自己的代码无关...!
数据库中的匹配日期是“带时区的日期时间”,例如:
"2015-01-16 00:00:22.491956+01"
最佳答案
PostgreSQL 不理解格式为 Sat Jan 17 2015 00:00:00 GMT+0100
的日期,但它可能正在尽力而为。这是 dates 的表格和 time它确实理解的格式。 A complete explanation can be found here .
您必须将 Sat Jan 17 2015 00:00:00 GMT+0100
转换为 Postgres 可以理解的格式。离the HTTP date format很近.
关于postgresql - 日期时间格式更改 PostgreSQL 中返回的行数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35168490/