tags:

views:

104

answers:

2

I have a date in this format: Apr9,20037:33am

How do I turn into a timestamp?

+5  A: 

strtotime() - Parse about any English textual datetime description into a Unix timestamp

$unix_timestamp = strtotime('Apr 9, 2002 11:33 am')

EDIT: Asker changed question, above no longer applies.

Mike B
-1: doesn't reflect updated question.
hobodave
Really? I should be penalized b/c the asker edited the premise of the question? At the very least you should have edited my answer to say it no longer applies.
Mike B
+3  A: 

If you have a format that can't be parsed also take a look at: date_parse_from_format

hkda150
Pentium10: Your seeming reluctance to put any personal effort into this is annoying. There are examples _on that page_ on what you can do if you are using a previous version of PHP. Please do some legwork yourself.
hobodave
Doesn't work out. If I make echo `date2sql('Apr9,20027:33am');` I get really weird value: 943956000
Pentium10
What's this `date2sql` function you're talking about?
ceejayoz
it's the method for older php versions for `date_parse_from_format`, linked on the PHP page
Pentium10
And why are you using it? (I'm not aware of this function... never heard about it) What php verion are you using?If you just used it because there is nearly the same example than yours on the php site, then please take care take you used it correctly...
hkda150
It's on the linked page you mentioned. Scroll down on that page.
Pentium10
Did you pay any attention to it, or did you just try to use it? It's for a specific date format, which isn't your format. Use your brain.
ceejayoz