1

I really dont get this...

This first statement below returns the expected rows - ONLY rows which have a date which are BEFORE/SMALLER than...

select matchdate, price, size, issell from matchmsg 
where matchdate <= '2015-01-17 00:00:00.000000+01' order by matchdate asc

The code below return rows with dates up to the 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: I use PostgresSQL, NodeJS and NPM Moment...BUT the result is from the PostgreSQL tool pgAminIII...so - it has nothing to do with my own code...!

matchdate in the DB is a "datetime with time zone" like:

"2015-01-16 00:00:22.491956+01"

PabloDK
  • 2,181
  • 2
  • 19
  • 42

1 Answers1

0

PostgreSQL does not understand dates of the format Sat Jan 17 2015 00:00:00 GMT+0100 but it's probably trying its best. Here are tables of the dates and time formats it does understand. A complete explanation can be found here.

You'll have to convert Sat Jan 17 2015 00:00:00 GMT+0100 to a format Postgres understands. It is very close to the HTTP date format.

Community
  • 1
  • 1
Schwern
  • 153,029
  • 25
  • 195
  • 336