PHP: strtotime () gives me the wrong timestamp
This is my code:
$testtime = str_replace('.', '-', '2009.07.08 17:01');
$timestamp = strtotime($testtime);
echo $timestamp . "\n";
echo $testtime . "\n";
echo date('Y-m-d H:t', $timestamp);
And this is my conclusion:
1247065260
2009-07-08 17:01
2009-07-08 17:31
What's wrong?
Thanks in advance.
+2
Ivar
source
to share
1 answer
Invalid parameters for date()
. You must use date('Y-m-d H:i', $timestamp)
.
t
- the number of days of the current month, therefore 31
.
+8
Koraktor
source
to share