views:

287

answers:

1

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 output:

1247065260

2009-07-08 17:01

2009-07-08 17:31

What's wrong?

Thank you in advance.

+3  A: 

Your parameters for date() are wrong. You should use date('Y-m-d H:i', $timestamp).

t is the number of days of the current month, therefore 31.

Koraktor
Haha ops, I mixed that up - how embarrassing. Thank you!
Ivarska