DATE_SUNDAY
DATE_SUNDAY
Horde Date wrapper/logic class, including some calculation functions.
__construct( $date = null, $timezone = null)
Builds a new date object. If $date contains date parts, use them to initialize the object.
Recognized formats:
$date | ||
$timezone |
toDays() : integer
Converts a date in the proleptic Gregorian calendar to the no of days since 24th November, 4714 B.C.
Returns the no of days since Monday, 24th November, 4714 B.C. in the proleptic Gregorian calendar (which is 24th November, -4713 using 'Astronomical' year numbering, and 1st January, 4713 B.C. in the proleptic Julian calendar). This is also the first day of the 'Julian Period' proposed by Joseph Scaliger in 1583, and the number of days since this date is known as the 'Julian Day'. (It is not directly to do with the Julian calendar, although this is where the name is derived from.)
The algorithm is valid for all years (positive and negative), and also for years preceding 4714 B.C.
Algorithm is from PEAR::Date_Calc
The number of days since 24th November, 4714 B.C.
fromDays(integer $days) : \Horde_Date
Converts number of days since 24th November, 4714 B.C. (in the proleptic Gregorian calendar, which is year -4713 using 'Astronomical' year numbering) to Gregorian calendar date.
Returned date belongs to the proleptic Gregorian calendar, using 'Astronomical' year numbering.
The algorithm is valid for all years (positive and negative), and also for years preceding 4714 B.C. (i.e. for negative 'Julian Days'), and so the only limitation is platform-dependent (for 32-bit systems the maximum year would be something like about 1,465,190 A.D.).
N.B. Monday, 24th November, 4714 B.C. is Julian Day '0'.
Algorithm is from PEAR::Date_Calc
integer | $days | the number of days since 24th November, 4714 B.C. |
A Horde_Date object representing the date.
getTimezoneAlias(string $timezone) : string
Returns the normalized (Olson) timezone name of a timezone alias.
We currently support Windows and Lotus timezone names, and timezone abbreviations.
string | $timezone | Some timezone alias. |
The Olson timezone name, or the original value, if no alias found.
setTimezone(string $timezone) : \Horde_Date
Converts this object to a different timezone.
string | $timezone | The new timezone. |
This object.
setNthWeekday(integer $weekday, integer $nth = 1)
Sets the date of this object to the $nth weekday of $weekday.
integer | $weekday | The day of the week (0 = Sunday, etc). |
integer | $nth | The $nth $weekday to set to (defaults to 1). Negative values count from end of the month (@since Horde_Date 2.1.0). |
compareDate(mixed $other) : integer
Compares this date to another date object to see which one is greater (later). Assumes that the dates are in the same timezone.
mixed | $other | The date to compare to. |
== 0 if they are on the same date
= 1 if $this is greater (later) <= -1 if $other is greater (later)
compareTime(mixed $other) : integer
Compares this to another date object by time, to see which one is greater (later). Assumes that the dates are in the same timezone.
mixed | $other | The date to compare to. |
== 0 if they are at the same time
= 1 if $this is greater (later) <= -1 if $other is greater (later)
compareDateTime(mixed $other) : integer
Compares this to another date object, including times, to see which one is greater (later). Assumes that the dates are in the same timezone.
mixed | $other | The date to compare to. |
== 0 if they are equal
= 1 if $this is greater (later) <= -1 if $other is greater (later)
diff(\Horde_Date $other) : integer
Returns number of days between this date and another.
\Horde_Date | $other | The other day to diff with. |
The absolute number of days between the two dates.