I'm writing a PHP app with a postgresql backend that stores the time each record is called. When I pull the date back (and echo it) I get this:
2001-09-08 21:07:56+01
When I run it though strtotime() I get this:
-1
(I have no idea if that is normal or not). When I then put that time though date("d/M/Y") I get:
01/Jan/1970
Can anyone see what I am doing wrong? I've heard that strtotime() is broken on some versions of PHP (I'm using whatever comes with Debian Potato) but apparently its possible to get postgresql to return a UNIX timestamp:
<!-- m --><a class="postlink" href="http://www.archonet.com/pgdocs/date-to-epoch.html">http://www.archonet.com/pgdocs/date-to-epoch.html</a><!-- m -->
although I have no idea how to merge that with the SELECT query I already have:
SELECT * FROM data ORDER BY is DESC LIMIT $number OFFSET $offset
Can someone either give me a fix to my PHP or my SQL?
2001-09-08 21:07:56+01
When I run it though strtotime() I get this:
-1
(I have no idea if that is normal or not). When I then put that time though date("d/M/Y") I get:
01/Jan/1970
Can anyone see what I am doing wrong? I've heard that strtotime() is broken on some versions of PHP (I'm using whatever comes with Debian Potato) but apparently its possible to get postgresql to return a UNIX timestamp:
<!-- m --><a class="postlink" href="http://www.archonet.com/pgdocs/date-to-epoch.html">http://www.archonet.com/pgdocs/date-to-epoch.html</a><!-- m -->
although I have no idea how to merge that with the SELECT query I already have:
SELECT * FROM data ORDER BY is DESC LIMIT $number OFFSET $offset
Can someone either give me a fix to my PHP or my SQL?