Hoe datum omzetten naar timestamp in PHP?

Hoe krijg ik de tijdstempel van bijvoorbeeld 22-09-2008?

PHP's strtotime() geeft

$timestamp = strtotime('22-09-2008');

Wat wel werkt met de Supported Date and Time Formats Docs.

Commentaren (10)

Er is ook strptime() die precies één formaat verwacht:

$a = strptime('22-09-2008', '%d-%m-%Y');
$timestamp = mktime(0, 0, 0, $a['tm_mon']+1, $a['tm_mday'], $a['tm_year']+1900);
Commentaren (5)

Met behulp van mktime:

list($day, $month, $year) = explode('-', '22-09-2008');
echo mktime(0, 0, 0, $month, $day, $year);
Commentaren (3)