0

I have a string "2013-10-09 00:00:00" and I use the code below to change it to a timestamp

date_default_timezone_set($timeZone);
$timeStamp = strtotime("2013-10-09 00:00:00"); //echos 1381269600

When I do

date_default_timezone_set($timeZone);
date("Y-m-d H:m",$timeStamp);

I get 2013-10-09 00:10:00. This is completely strange. Why do I get this 10 minutes difference?

idipous
  • 2,868
  • 3
  • 30
  • 45

1 Answers1

8

Because you are using the m which is for the month not for the minute. You need to use i.

See http://php.net/manual/en/function.date.php

Your code should be

date("Y-m-d H:i", $timeStamp);
SamV
  • 7,548
  • 4
  • 39
  • 50