Re: Re: Why doesn't php have a 'date' variable type?

From: Date: Fri, 21 May 2004 00:12:14 +0000
Subject: Re: Re: Why doesn't php have a 'date' variable type?
References: 1 2  Groups: php.windows 
Request: Send a blank email to php-windows+get-23786@lists.php.net to get a copy of this message
Thanks Walter and also Justin Patrin for pointing out the Pear Date class. I just had a quick look and it looks very promising. I still think this sort of thing would be considerably more efficient and accessable to have in native php code in some manner, but it looks like this pear class will certainly help. Thanks again Walter and Justin. Regards ... Ross At 01:29 AM 21/05/2004, you wrote:
PEAR:Date Walter "Ross Honniball" <ross@bookshop.jcu.edu.au> wrote in message news:6.0.0.22.1.20040520183040.01ca2ea8@bookshop2.jcu.edu.au... I accidently sent this to php-db mailing list earlier today. Apologies to people who get it twice. Why doesn't php offer a standard class or variable type to help process dates in a standard manner? Php should offer a DATE variable type (in addition to string, int, array, object etc.). Date variables could be created by utilising standard date functions. eg. $birthday = SetDate('23-07-1985', 'dmy'); Use of this function would effectively declare $birthday as a field of type date. (note that I wish this was my birthday). Standard maths could be performed on date fields for comparison. eg. $newdate = $start_date + $birthdate - 5; // as in days if ($date1 < $date2) ..whatever..; And of course standard routines for formating dates, standard routines for showing time between dates / times etc. would all understand the date variable type. This frustrated me so much that I recently wrote a class to emulate, as best as possible, this level of functionality, which would actually be quite adequate if Windows didn't suck. But due to some lunatic Windows limitation, the php DATE() funciton will only work on dates between 1970 and 2038. Annoying. Anyway, am I missing something, or do other people find this a glaring omission in an otherwise spiffing product? Ross PS note that in refering to dates above, I really mean date + time.
. Ross Honniball                  JCU Bookshop Cairns Supervisor
. James Cook Uni, McGreggor Rd, Smithfield, Qld. 4878, Australia . Ph:07.4042.1157 Fx:07.4042.1158 Em:ross@bookshop.jcu.edu.au . There are no problems. Only solutions. -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
. . Ross Honniball. JCU Bookshop Cairns, Qld, Australia. .

« previous php.windows (#23786) next »