What's the best way to convert a date and time into a timestamp using php?
Posted
by
user1267980
on Stack Overflow
See other posts from Stack Overflow
or by user1267980
Published on 2012-06-28T03:12:32Z
Indexed on
2012/06/28
3:15 UTC
Read the original article
Hit count: 113
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.
© Stack Overflow or respective owner