Date class not formatting my date
| From: | Mike Carter | Date: | Thu, 27 Nov 2003 16:51:02 +0000 |
| Subject: | Date class not formatting my date | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-9186@lists.php.net to get a copy of this message | ||
Hi,
Whilst having problems with dates before 1970 when converting them to UTC
for sending via webservices I decided to take a look at the PEAR Date class.
I wrote some test code, as follows:-
<?php
include 'Date.php';
$values['dob']['d'] = "5";
$values['dob']['m'] = "2";
$values['dob']['Y'] = "1952";
$dateObj = new Date;
$dateObj->setYear($values['dob']['Y']);
$dateObj->setMonth($values['dob']['m']);
$dateObj->setDay($values['dob']['d']);
$dateObj->setHour(12);
$dateObj->setMinute(0);
$dateObj->setSecond(0);
$dateObj->setTZ('UTC');
var_dump($dateObj->getDate(DATE_FORMAT_ISO_BASIC));
?>
The output is NULL, however I was expecting to see my date parameters in the
format "YYYYMMSSTHHMMSS(Z|(+/-)HHMM)?" (defined as DATE_FORMAT_ISO_BASIC).
Can anybody tell me why its not working, or is it a Date class bug? From
the pear command tool line:-
Date 1.3.1beta beta
Regards,
--
Mike Carter
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________