tags:

views:

475

answers:

5

Hi!! I have to use php function date_parse but it is supported for 5.2.*. So is there any alternative for function date_parse for php 5.1.*. Hope to get answer........

Thanks ............

A: 

Don't know exactly what you mean by alternative but check this out:

php.net getdate()

Tip: look to the left you will see related functions.

Babiker
A: 

PHP Date/Time Functions

musicfreak
A: 

Try:

getdate(strtotime($datestr))

Note that some keys are slightly different (eg. 'seconds' rather than 'second' and 'mday' rather than 'day') and getdate doesn't include any error information. getdate also doesn't support fractions of a second.

outis
Ah - yeah, what you said. :-)
Stobor
+3  A: 

strtotime, possibly combined with getdate, localtime or gmtime

getdate(strtotime("20 Jan 2009"));

strtotime takes a string, and converts it into a unix timestamp, and the other three functions convert a unix timestamp into an array like date_parse.

Stobor
A: 

Just wonder what for?

strtotime() seems to be the closest answer. Use timestamps (see time(), mktime() etc.) to avoid such string parsing.

Jet