Convert Unix epoch timestamp to MySQL timestamp in PHP

I have a problem where a client has some outdated environment (IIS 6 / PHP 5.0.1) and keeps getting the following error:

Warning: date () [function.date]: Windows does not support dates before midnight (00:00:00) January 1, 1970 in "when using the date () function.

I need to find a way to convert my UNIX timestamp i.e. "1293559200" (Dec 28, 2010) into what I can pass as the correct date.

+2


source to share


1 answer


SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y-%m-%d %H:%i:%s');

      



If you can replace UNIX_TIMESTAMP () with your timestamp value.

+6


source







All Articles