Re: How to convert integers representations of a date to a date format variable

From: Date: Wed, 02 Jan 2002 02:58:27 +0000
Subject: Re: How to convert integers representations of a date to a date format variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-79200@lists.php.net to get a copy of this message
"Carlos Fernando Scheidecker Antunes" <nando@antunes.eti.br> wrote in message news:002c01c19197$7beb6c40$0a505ad1@Nando4... > Hello All, > > I would like to convert integers like the day, month and year to a date representation to store it in a session variable. > > There's a form where the user posts day, month and year. So then I run checkdate($month,$day,$year) and make sure the date is valid. > > So, let's say I have 12 for month, 30 for day and 2001 as year. Do I have to create a timestamp? How to create a > TimeStamp? > > I need to store it as 30/12/2001 (but not a string) not only on a session variable but also to make it easier to work with a MySQL table. > > After that I want to play with it as a string so I will use the date() function, that's why it is important to save it as a validade date format value. > > Any sugestions? > > Thank you in advance, > > Carlos Fernando. > Linux User #207984 see http://php.net/mktime or http://php.net/gmmktime , which will give you a unix timestamp that date() will accept (as will FROM_UNIXTIME() in MYSQL if you want to use that for storing it in the database) mktime(0, 0, 0, $month, $day, $year) should do the trick -- Daniel Grace

« previous php.general (#79200) next »