Simple date class to perform basic date calculations
WARNING USING TICKS DIRECTLY IS DANGEROUS
The ticks variable here is a little problematic... daylight saving transitions tend to make it rather frought. For example, for the purposes of this system, if you want to know what 4 days after 9am 20th March is, you expect to get 9am 23rd March regardless of a timezone change from daylight saving.
For example, this might not give you what you want:
Located in /inc/date.php (line 42)
construct a Date-Time object
constructor will work with $time in the following formats:
add a whole number of days to the current date-time
add a whole number of seconds to the current date-time
add a time (i.e. a number of seconds) to the current date-time
Add components to the current date-time
Note that this function will take account of daylight saving in unusual (but quite sensible) ways... for example, if $today is a SimpleDate object representing midday the day before daylight saving ends, then $today->addTimeParts(24*60*60) will give a different result to $today->addTimeParts(0,0,0,1). The former will be exactly 24 hours later than the original value of $today (11:00), but the latter will 1 calendar day later (12:00).
round (down) the date-time to the current day
sets the current YYY-MM-DD HH:MM:SS to YYYY-MM-DD 00:00:00
returns the number of days between two dates ($this - $date)
note that it will return fractional days across daylight saving boundaries
return the (short) day of week of the current date as a string (in current language)
return the day of week of the current date as a string (in current language)
returns the number of days between two dates ($this - $date) accounting for daylight saving
dump the datetimestring and ticks in a readable format
round time down to the nearest $g time-granularity measure
Example: if this date time is set to 2005-11-21 17:48 and $g represents 00:15:00 (i.e. 15 minutes) then this date-time would be set to 2005-11-21 17:45 by rounding to the nearest 15 minutes.
get a long string representation for the current locale
get a long string representation for the current locale
get a long string representation for the current locale
get a short string representation for the current locale
get a short string representation for the current locale
get a short string representation for the current locale
Get a string representation of this time in the specified format
Recognised format characters are as follows:
d Day of the month, 2 digits with leading zeros 01 to 31 D A textual representation of a day, three letters Mon through Sun j Day of the month without leading zeros 1 to 31 l (lowercase 'L') A full textual representation of the day of the week Sunday through Saturday
F A full textual representation of a month, such as January or March January through December m Numeric representation of a month, with leading zeros 01 through 12 M A short textual representation of a month, three letters Jan through Dec n Numeric representation of a month, without leading zeros 1 through 12
Y A full numeric representation of a year, 4 digits Examples: 1999 or 2003 y A two digit representation of a year Examples: 99 or 03
a Lowercase Ante meridiem and Post meridiem am or pm A Uppercase Ante meridiem and Post meridiem AM or PM g 12-hour format of an hour without leading zeros 1 through 12 G 24-hour format of an hour without leading zeros 0 through 23 h 12-hour format of an hour with leading zeros 01 through 12 H 24-hour format of an hour with leading zeros 00 through 23 i Minutes with leading zeros 00 to 59 s Seconds, with leading zeros 00 through 59
round (down) the date-time to the start of the current month (the 1st)
return the (short) month of the year of the current date as a string (in current language)
return the month of year of the current date as a string (in current language)
returns the number of days (or part thereof) between two dates ($this - $d)
round (down) the date-time to the start of the current quarter (1st Jan, 1st Apr, 1st Jul, 1st Oct)
set the date and time from a string
set the date and time from seconds since epoch
Sets the time component of this date-time to the specified time but with the same date as currently set
The specified time can be HH:MM HH:MM:SS, seconds since midnight or a SimpleTime object
Set current date-time by components
returns the number of seconds between two times
NB this does not specially account for daylight saving changes, so will not always give the 24*60*60 for two datetimes that are 1 day apart on the calendar...!
returns a SimpleTime object for just the time component of this date time
round (down) the date-time to the start of the current week (Sunday)
round (down) the date-time to the start of the current year (1st Jan)
translate an individual date-related word (day of week, month of year)
Documentation generated on Tue, 06 Mar 2007 10:01:12 +0000 by phpDocumentor 1.3.0