Re: HTML_QuickForm_Date display before 1969

From: Date: Tue, 18 Jan 2005 07:45:38 +0000
Subject: Re: HTML_QuickForm_Date display before 1969
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16987@lists.php.net to get a copy of this message
Hi, Sarah Gray wrote:
Weird (to me) behaviour. I'm a little stuck on it. I have a date dropdown menu that displays the correct date *unless* the date falls before unix epoch begins (12-31-1969). No matter what the date is, if the date falls before 12-31-69, my date dropdown menu displays 31-Dec-1969 .
If you pass the default date as string, then it goes through strtotime() PHP function which does not handle dates before 1970 on several platforms. The solution would be doing something like this in your postGenerateForm(): $QF_date =& $form->addElement('DOB', 'Date of Birth',$options); $dateAry = explode('-', $this->DOB); $QF_date->setValue(array(
    'd' => $dateAry[2],
    'M' => $dateAry[1],
    'Y' => $dateAry[0]
));

« previous php.pear.general (#16987) next »