Re: Date maths

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

 



Dave, 

Luckily for you there is a whole whack of functions made specifically
for these issues...

On Sun, 2006-09-10 at 21:19 +0100, Dave Goodchild wrote:
> So, when an event-holder enters a repeating event, the main event details
> are held in the events table, and all the relevant dates for the event (they
> specify the first date of the event and the last date it is to be held) are
> entered into the calendar table by increment (ie timestamp intervals by 24
> hours, 7 days or monthly, and I know monthly is going to be tricky as it is
> a fluctuating interval).
> 

Have a look at the PHP manual entries for date() and strtotime(). There
are a few others, but this should get you well started!

There is also a PEAR::Date object that you may find useful, as well as a
calendar object IIRC. 

There are a few basics that you want to keep in mind though:

1. strtotime works well, but make sure that your date/time strings
conform to the GNU datetime specs.

2. There are 86400 seconds in a day.

3. Date also accepts parameters like +1month and -1month, this works for
days, weeks, months etc. 

4. Google "php calendar class and php date class" you will get like a
bazillion resources that will really help out.

HTH a bit...

--Paul



All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux