Yes, it does!  That's why I find it so useful. :)

http://www.php.he.net/manual/en/function.mktime.php

Quoted:
====================================================
mktime() is useful for doing date arithmetic and validation, as it will
automatically calculate the correct value for out-of-range input. For
example, each of the following lines produces the string "Jan-01-1998".
Example 1. mktime() example

<?php
echo date("M-d-Y", mktime(0, 0, 0, 12, 32, 1997));
echo date("M-d-Y", mktime(0, 0, 0, 13, 1, 1997));
echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 1998));
echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 98));
?>  
 
Year may be a two or four digit value, with values between 0-69 mapping
to 2000-2069 and 70-99 to 1970-1999 (on systems where time_t is a 32bit
signed integer, as most common today, the valid range for year is
somewhere between 1901 and 2038). 

Windows: Negative timestamps are not supported under any known version
of Windows. Therefore the range of valid years includes only 1970
through 2038. 
====================================================


Another tidbit regarding mktime:
====================================================
The last day of any given month can be expressed as the "0" day of the
next month, not the -1 day. Both of the following examples will produce
the string "The last day in Feb 2000 is: 29". 

Example 2. Last day of next month

<?php
$lastday = mktime(0, 0, 0, 3, 0, 2000);
echo strftime("Last day in Feb 2000 is: %d", $lastday);
     
$lastday = mktime(0, 0, 0, 4, -31, 2000);
echo strftime("Last day in Feb 2000 is: %d", $lastday);
?>  
====================================================

Kind of goofy, but good stuff.

-TG


> -----Original Message-----
> From: Vail, Warren [mailto:[EMAIL PROTECTED] 
> Sent: Friday, September 10, 2004 4:47 PM
> To: Gryffyn, Trevor; [EMAIL PROTECTED]
> Cc: Louie Miranda
> Subject: RE: [PHP] Adding +7 more days on date() value problem
> 
> 
> So if this is run on the 30th of the month, you are saying 
> this handles a
> month with day 37 correctly?
> 
> Warren Vail
> 
> 
> -----Original Message-----
> From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED] 
> Sent: Friday, September 10, 2004 11:58 AM
> To: [EMAIL PROTECTED]
> Cc: Louie Miranda
> Subject: RE: [PHP] Adding +7 more days on date() value problem
> 
> 
> I disagree on the strtotime recommendations that everyone 
> else gave. The
> mktime() function itself will compensate for leap years, "day 
> = 36" type
> stuff and all of that.
> 
> <?php
> $curdate = date("Y-m-d");
> $plus7 = date("Y-m-d",mktime(0,0,0,date("m"),date("d")+7,date("Y")));
> Echo "Current Date: $curdate<br>";
> Echo "+7 Dats Date: $plus7";
> ?>
> 
> 
> Simple as that!
> 
> -TG
> 
> > -----Original Message-----
> > From: Louie Miranda [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, July 27, 2004 11:31 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Adding +7 more days on date() value problem
> > 
> > 
> > I can't figure how could i add +7 more days on the DD (Day) 
> value. My 
> > problem is, when the day is close on the end of the month like
> > 
> > 07/29/2004
> > 
> > when i add +7 on 29 = 36, its obvious we dont have 36 on 
> the calendar. 
> > And im creating a program below, to explode it and maybe 
> just add +. 
> > But i think its useless if im just going to do + on the DD (Day) 
> > value.
> > 
> > Hmm :?
> > 
> > ##
> > <?php
> > $curdate = date("Y-m-d");
> > $plus7 = explode("-", $curdate);
> > 
> > print ("
> > <p>cut:
> > " .$plus7[0]. "
> > " .$plus7[1]. "
> > " .$plus7[2]. "
> > </p>
> > 
> > Current Date: $curdate<br>
> > +7 Dats Date: $plus7
> > 
> > ");
> > ?>
> > ##
> > 
> > --
> > Louie Miranda
> > http://www.axishift.com
> > 
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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

Reply via email to