Re: Date-class
| From: | Tomas V.V.Cox | Date: | Wed, 18 Jul 2001 09:08:17 +0000 |
| Subject: | Re: Date-class | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-859@lists.php.net to get a copy of this message | ||
Erik Hjortsberg wrote:
>
> Ok, I've written a date class for making atomic date instances.
> The current Date classes do only provide static methods.
> There is however a need for a common format for handling dates in an
> application, especially in a multi-developer situation (such as PEAR).
>
> Anyhow, a short introduction
>
[..]
>
> I've chosen to use a timestamp as internal representation for now. That
> will probably change.
> I've also tried to keep the extra methods to a minium to keep it simple. If
> you want a special formatting you can do it with date('fsdafd',
> $date->timestamp()). Plus, the methods provided by Date_Date are also >helpful.
I think all of we have developed some time a Date handler functions :)
Here is mine if you want to ripe some code (doc is only in spanish but
code and function names are in english). It's only for dates but support
iso/english/euro dates input/output, months and days in both
spanish/english (extendable), use timestamp as internal and provide the
following functions:
- check_date: Valida una fecha usando la funcion checkdate de php
- convertdate: Convierte fechas entre los formatos iso, euro y eng
- today: retorna fecha de hoy en formato $DATEFORMAT
- monthplus: Retorna la fecha introducida + $num meses
- dayplus: Retorna la fecha introducida + $num dias
- monthlastday: Retorna la fecha del ultimo dia del mes de una fecha
dada
- monthfirstday: Retorna la fecha del primer dia del mes de una fecha
dada
- getdaynameof: Retorna el nombre completo del dia de una fecha en un
idioma dado
- getmonthnameof: Retorna el nombre completo del mes de una fecha en un
idioma dado
- getdayof: Retorna el dia de una fecha
- getmonthof: Retorna el mes de una fecha
- getyearof: Retorna el año de una fecha
- comparedates: Compara dos fechas
- count_days
Url:
http://vulcanonet.com/soft/dates/
If you are interested in it and don't understand something please let me
know.
Tomas V.V.Cox
PD.-Don't forget the timestamp limitation.