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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PEAR:Date

Walter


"Ross Honniball" <ross@xxxxxxxxxxxxxxxxxxx> wrote in message
news:6.0.0.22.1.20040520183040.01ca2ea8@xxxxxxxxxxxxxxxxxxxxxxx
> 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@xxxxxxxxxxxxxxxxxxx
> . There are no problems. Only solutions.

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux