If you're using a database, it may be able to take
care of this for you. If you're using mysql:

6.3.4 Date and Time Functions
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#Date_and_time_functions

olinux 


--- Fred Merritt <[EMAIL PROTECTED]> wrote:
> Qt,
>       The easiest way is to convert your dates into a
> serial day number(i.e. 
> the number of days that have elapsed between your
> date, and some 
> arbitrary date in the dim and distant past - I think
> PHP uses 25th 
> November, -4714).  There are some calendar functions
> in php that will do 
> this for you.  Once you have your dates as a numeric
> offset, you can 
> subtract them to get a the number of days between
> the dates, or you can 
> add or subtract a number of days to get a new
> offset.  Once you have the 
> new offset, there are reverse calendar functions in
> php, to convert your 
> new offset back to a calendar date.
> 
> Check out the functions GregorianToJD(), and
> JDToGregorian(), in the 
> Calendar functions of the PHP manual.  If you do not
> have access to the 
> calendar functions in your version of php, there are
> also a couple of 
> examples how to do one of the conversions written in
> PHP, in the user 
> contributed notes of the manual.  There are also
> many published articles 
> describing algorithms on how to do this.  I can
> remember implementing 
> these functions in 1977(Not in PHP of course), from
> an article published 
> in the journal of the ACM, in 1963.
> 
> Hope this helps. . . Fred
> 
> Qt wrote:
> > Dear Sirs,
> > 
> > How can I add or subtract two date easily. Is
> therea any lib or function
> > about this. I can not find any easy way in the
> manual
> > 
> > Best Regards
> > 

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

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

Reply via email to