What's the best way to convert a date and time into a timestamp using php?
- by user1267980
I need to convert a date and time into a timestamp with php. The following code shows what I'm currently using:
<?php
$date="2012-06-29 10:50";
$timestamp = strtotime($date);
echo $timestamp;
?>
However, when I test the timestamp in an online convertor (http://www.epochconverter.com), the resulting date is 29th June 2012, 8:50, or 2 hours previous. Is it possible that the strtotime() function isn't completely accurate and is just an estimate of the time? If so, are there better methods I could use for getting the exact time?
Thanks.