I have a $start_date that is defined as “today – 30 days”. When trying to convert this to German notation, the date prints as 01. Januar 1970 (instead of 10. March 2012) I understand this means Unix interprets the results as “0” but I can’t figure out what I am doing wrong.
$start_date = date("Y-m-d", strtotime("-30 days"));
setlocale(LC_TIME, 'de_DE');
$start_date_DE = strftime('%d. %B %Y',$start_date);
The problem is
strftimeexpects a timestamp as the second parameter, but you’re passing a string to it (in format “Y-m-d”). So it’s returning the UNIX epoch (1/1/1970).Try this instead:
http://codepad.org/pK9J07Wm