Re: Why doesn't php have a 'date' variable type?
| From: | \[php\]Walter | Date: | Thu, 20 May 2004 15:29:17 +0000 |
| Subject: | Re: Why doesn't php have a 'date' variable type? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-23784@lists.php.net to get a copy of this message | ||
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.