List:General Discussion« Previous MessageNext Message »
From:Daevid Vincent Date:July 9 1999 10:16pm
Subject:is the date function wrong in PHP 3.07 or mySQL 3.22.22?
View as plain text  
Hello, I'm using PHP3.07 and mysql  Ver 9.32 Distrib 3.22.22, for pc-linux-gnu
(i686), I'm noticing the date function in PHP or perhaps the unix_timestamp in
mySQL is possibly erroneous.

mysql> SELECT function_date, UNIX_TIMESTAMP(function_date) AS date  FROM
Function_Table where function_id = 120;

+----------------+-----------+
| function_date  | date      |
+----------------+-----------+
| 19990709144636 | 931556796 |
+----------------+-----------+

in PHP I'm trying to use: echo date("m/d/y h:m:sA",$date);

and it is giving me: "07/09/99 02:07:36PM" as the responce.
when I would expect "07/09/99 02:46:36PM"
this example is exactly 39 minutes off.

mysql> SELECT function_date, UNIX_TIMESTAMP(function_date) AS date  FROM
Function_Table where function_id = 21;
+----------------+-----------+
| function_date  | date      |
+----------------+-----------+
| 19990624130952 | 930254992 |
+----------------+-----------+

yields: "06/24/99 01:06:52PM" when it should be "06/24/99 01:09:52PM"
which is exactly 3 minutes off.

my 'function_date' field is defined as: timestamp(14)

Am I not using the PHP date() correctly?
http://www.php.net/manual/function.date.php3 says, "Returns a string formatted
according to the given format string using the given timestamp or the current
local time if no timestamp is given. " So is that a unix timestamp?
Trying to use the 'function_date' value was way off. This feels like I'm doing
it right, because the m/d/y h:s are all correct, and that would be to big a
coincidence it seems...

I checked the change logs for PHP and no mention of this scenario was in them.

Daevid.
http://www.wildtangent.com/developer/api



Thread
is the date function wrong in PHP 3.07 or mySQL 3.22.22?Daevid Vincent10 Jul
  • Re: is the date function wrong in PHP 3.07 or mySQL 3.22.22?Shaun Batterton12 Jul
  • Re: is the date function wrong in PHP 3.07 or mySQL 3.22.22? (solved)Daevid Vincent13 Jul