Re: Date question?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



you also can do

<?
$date_as_string = "2003-04-02";

$temp = explode("-", $date_as_string); // Cuts your String at '-' and stores
it in the $temp - Array

$date_as_timestamp = mktime(1,0,0,$temp[1], ($temp[2]+9), $temp[0]); //
contains the timestamp to the date 9 Months ahead

echo date("Y-j-n", $date_as_timestamp); // puts out the date in this form:
Year-Days-Month
?>

check out date() and mktime() in the php manual... oh yeah and i supposed
2003-04-02 to mean February 4th 2003 if i'm wrong you have to change the
mktime line..

----- Original Message -----
From: "Disko_kex" <disko_kex@swedish-mushroom.com>
To: <php-windows@lists.php.net>
Sent: Friday, September 12, 2003 3:50 PM
Subject:  Date question?


> Hi
>
> If I have a date (2003-04-02) and want to select 9 months later, how to
> do?
>
> Thanks.
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux