Re: How to convert a date to an int?(Need help as soon as possible)
| From: | Alexander Skwar | Date: | Sat, 03 Mar 2001 00:15:43 +0000 |
| Subject: | Re: How to convert a date to an int?(Need help as soon as possible) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42409@lists.php.net to get a copy of this message | ||
So sprach Fang Li am Fri, Mar 02, 2001 at 06:58:45PM -0500:
> Hi, All,
> I am stucked here.Would you please help as soon as you can?
>
> LiveDate = "Mar 12,2001"
>
> how to convert it to a int?
$months = array( "Jan" => 1,
"Feb" => 2,
...........
"Dec" => 12
);
$month = substr($LiveDate, 3);
$month_num = $months( $month );
$comma = strpos($LiveDate, ",");
$day = substr($LiveDate, 2, $comma - 2);
$year = substr($LiveDate, 4, $comma);
Something like this should work - I'm not too sure about the values for
substr, but it should give you an idea.
Alexander Skwar
--
How to quote: http://learn.to/quote (german) http://quote.6x.to (english)
Homepage: http://www.digitalprojects.com | http://www.iso-top.de
iso-top.de - Die guenstige Art an Linux Distributionen zu kommen
Uptime: 1 day 1 hour 5 minutes