日期时间格式更改 PostgreSQL 中返回的行数
Datetime format change the number of returned rows in PostgreSQL
我真的不明白这个...
下面的第一个语句 return 是预期的行 - 只有日期 BEFORE/SMALLER 比...
的行
select matchdate, price, size, issell from matchmsg
where matchdate <= '2015-01-17 00:00:00.000000+01' order by matchdate asc
下面的代码 return 行的日期截至 2015 年 1 月 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...所以 - 它与我自己的代码无关...!
数据库中的匹配日期是 "datetime with time zone",例如:
"2015-01-16 00:00:22.491956+01"
PostgreSQL 不理解 Sat Jan 17 2015 00:00:00 GMT+0100
格式的日期,但它可能正在尽力而为。这是 dates and time formats it does understand. A complete explanation can be found here.
的表格
您必须将 Sat Jan 17 2015 00:00:00 GMT+0100
转换为 Postgres 可以理解的格式。它非常接近。
我真的不明白这个...
下面的第一个语句 return 是预期的行 - 只有日期 BEFORE/SMALLER 比...
的行select matchdate, price, size, issell from matchmsg
where matchdate <= '2015-01-17 00:00:00.000000+01' order by matchdate asc
下面的代码 return 行的日期截至 2015 年 1 月 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...所以 - 它与我自己的代码无关...!
数据库中的匹配日期是 "datetime with time zone",例如:
"2015-01-16 00:00:22.491956+01"
PostgreSQL 不理解 Sat Jan 17 2015 00:00:00 GMT+0100
格式的日期,但它可能正在尽力而为。这是 dates and time formats it does understand. A complete explanation can be found here.
您必须将 Sat Jan 17 2015 00:00:00 GMT+0100
转换为 Postgres 可以理解的格式。它非常接近。