RE: [PEAR] Date class not formatting my date
| From: | Mike Carter | Date: | Thu, 27 Nov 2003 17:18:09 +0000 |
| Subject: | RE: [PEAR] Date class not formatting my date | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9188@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Mike Carter [mailto:mikeatwork@ukonline.co.uk]
>
> 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
I upgraded to the latest Date.php from CVS
$Id: Date.php,v 1.17 2003/11/18 02:21:44 mroch Exp $
If I comment out the $dateObj->setTZ('UTC'); line it works fine now. With
the TZ call it causes an error (reported to pear bugs). A new release of
the Date class would be nice. Please Please.
Regards,
Mike.
________________________________________________________________________
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
________________________________________________________________________