I am wrestling with a php 5.2.6 problem. An api we use returns dates in this format DDMMYYYYHHMM. Exactly that format, fixed length, no delimiters. However, in my experimentation, this format seems to break strptime, which returns a false (fail) when I feed it a date in this format. It can reproduced, at least on my system, with this example:
$format = "%d%m%Y%H%M"; echo print_r(strptime(strftime($format,1225405967),$format),true);
If I add any character between the date and the time, it works, even a space. So, this DOES work:
$format = "%d%m%Y %H%M"; echo print_r(strptime(strftime($format,1225405967),$format),true);
Am I missing something obvious?
edit: further to this and owing to the results indicated by the comments, this seems to be platform specific. I can reproduce it on the Macs running OSX Leopard in the office but the Linux boxes parse it fine. I assume it is a bug or idiosyncrasy of the strptime in the underlying C library in the *nix of OSX.