Re: Challenge for the manual
| From: | Kirk Babb | Date: | Sat, 18 May 2002 02:36:11 +0000 |
| Subject: | Re: Challenge for the manual | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2021@lists.php.net to get a copy of this message | ||
This may not be the exact solution, but it should be a start for you anyway.
Try reading the manual, really. I'm a newbie and this took me a total of 5
minutes to throw together. The manual pays off! Use it, and you are much
less likely to be flamed. Trust me, I've been there.
From the manual:
http://www.php.net/manual/en/function.split.php
$date = "04/30/1973"; // Delimiters may be slash, dot, or hyphen
list ($month, $day, $year) = split ('[/.-]', $date);
echo "Month: $month; Day: $day; Year: $year<br>\n";
Again, from the manual:
http://www.php.net/manual/en/function.strftime.php
<?php
$diff = time() - mktime(8,30,0,1,12,1978,0);
/*Jan 12th 1978, 8:30 AM*/
$week = strftime("%W",$diff);
$year = strftime("%Y",$diff) - 1970;
$day = strftime("%w",$diff);
echo "($year years, $week weeks and $day days)";
?>
Kirk
----- Original Message -----
From: "Josh Edwards" <josho@tpg.com.au>
To: <php-gtk-general@lists.php.net>
Sent: Friday, May 17, 2002 9:17 PM
Subject: [PHP-GTK] Challenge for me
> I want to convert 09/05/2002 to a timestamp so I can calculate the
> difference b/w two dates - anyone know of a good way to do this
>
>
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>