[thelist] PHP Date Handling

m u i n a r muinar at gmx.net
Thu Jul 4 07:17:01 CDT 2002


At 19:38 02.07.02, you wrote:
>Hi Guys,
>
>I'm looking for any pointers to tutorials/documentation on date-handling in
>php. O'Reilly's Programming PHP is pretty light on the topic. I'm used to
>working in coldfusion, where datehandling is a snap.
>
>Specific problem is how to increment a value by one day for a Mysql database
>limit. I may just add 235959 time to the datestamp instead of having to
>write logic for end of month incrementing.

Once you get used to it, it's a snap in PHP too. Try for example:

         $checkDate = date( "Y-m-d",mktime( 0,0,0,$month,$day + 1,$year ) );

The first part, "Y-m-d", is to format the result as yyyy-mm-dd. Then you
simply
add 1 to the day, like $day + 1 in the example, and the date() function in
front of it
will do the rest.

Check out the date functions at http://php.net/

HTH

Mike







More information about the thelist mailing list