PHP: Convert a german date format (%d.%m.%Y) into a valid unix timestamp? [duplicate] PHP: Convert a german date format (%d.%m.%Y) into a valid unix timestamp? [duplicate] wordpress wordpress

PHP: Convert a german date format (%d.%m.%Y) into a valid unix timestamp? [duplicate]


Just use DateTime (strtotime, works similar but I prefer DateTime):

$a = new DateTime('08.05.2012');echo $a->getTimestamp();

strtotime and the DateTime library are very well written and they detect nearly every case, so you are good to go.

Otherwise, just pick a DATE field in your database, then you can sort it there too.