views:

158

answers:

3

Hi-- I have a UK date in the format "06/Apr/2010 13:24" that I need to insert into a mysql db date field.

The PHP strtotime function can't handle this string-- has anyone got any ideas other than writing a custom function?

Thanks!

A: 

It looks like you could substring on the space then explode on the "/"'s and then be able to get each piece to work with. Seems odd that there isn't already a way to do this...

Kris.Mitchell
+4  A: 

Try replacing / with -

strtotime(str_replace('/', '-', '06/Apr/2010 13:24'));
webbiedave
thanks webbiedave-- that's the quick and easy answer I was hoping for!
julio
You're welcome. Glad I could help.
webbiedave
A: 

How about

$date = strtotime(str_replace('/',' ',$date).":00");
mplungjan