Generic date handling class for PEAR.
Generic date handling class for PEAR. Attempts to be time zone aware through the Date::TimeZone class. Supports several operations from Date::Calc on Date objects.
Located in /maintenance/libraries/pear/Date.php (line 70)
the day
the hour
the minute
the month
the parts of a second
the second
timezone for this date
the year
Constructor
Creates a new Date Object initialized to the current date/time in the system-default timezone by default. A date optionally passed in may be in the ISO 8601, TIMESTAMP or UNIXTIME format, or another Date object. If no date is passed, the current date/time is used.
Adds a given number of seconds to the date
Adds a given number of seconds to the date
Adds a time span to the date
Adds a time span to the date
Test if this date/time is after a certian date/time
Test if this date/time is after a certian date/time
Test if this date/time is before a certain date/time
Test if this date/time is before a certain date/time
Compares two dates
Compares two dates. Suitable for use in sorting functions.
Converts this date to a new time zone
Converts this date to a new time zone. WARNING: This may not work correctly if your system does not allow putenv() or if localtime() does not work in your environment. See Date::TimeZone::inDaylightTime() for more information.
Converts this date to a new time zone, given a valid time zone ID
Converts this date to a new time zone, given a valid time zone ID WARNING: This may not work correctly if your system does not allow putenv() or if localtime() does not work in your environment. See Date::TimeZone::inDaylightTime() for more information.
Copy values from another Date object
Makes this Date a copy of another Date object.
Test if this date/time is exactly equal to a certian date/time
Test if this date/time is exactly equal to a certian date/time
Date pretty printing, similar to strftime()
Formats the date in the given format, much like strftime(). Most strftime() options are supported.
formatting options:
abbreviated weekday name (Sun, Mon, Tue)
- %a
full weekday name (Sunday, Monday, Tuesday)
- %A
abbreviated month name (Jan, Feb, Mar)
- %b
full month name (January, February, March)
- %B
century number (the year divided by 100 and truncated to an integer, range 00 to 99)
- %C
day of month (range 00 to 31)
- %d
same as "%m/%d/%y"
- %D
day of month, single digit (range 0 to 31)
- %e
number of days since unspecified epoch (integer, Date_Calc::dateToDays())
- %E
hour as decimal number (00 to 23)
- %H
hour as decimal number on 12-hour clock (01 to 12)
- %I
day of year (range 001 to 366)
- %j
month as decimal number (range 01 to 12)
- %m
minute as a decimal number (00 to 59)
- %M
newline character (\n)
- %n
dst-corrected timezone offset expressed as "+/-HH:MM"
- %O
raw timezone offset expressed as "+/-HH:MM"
- %o
either 'am' or 'pm' depending on the time
- %p
either 'AM' or 'PM' depending on the time
- %P
time in am/pm notation, same as "%I:%M:%S %p"
- %r
time in 24-hour notation, same as "%H:%M"
- %R
seconds including the decimal representation smaller than one second
- %s
seconds as a decimal number (00 to 59)
- %S
tab character (\t)
- %t
current time, same as "%H:%M:%S"
- %T
weekday as decimal (0 = Sunday)
- %w
week number of current year, first sunday as first week
- %U
year as decimal (range 00 to 99)
- %y
year as decimal including century (range 0000 to 9999)
- %Y
literal '%'
- %%
Get a string (or other) representation of this date
Get a string (or other) representation of this date in the format specified by the DATE_FORMAT_* constants.
Returns the day field of the date object
Returns the day field of the date object
Gets the full name or abbriviated name of this weekday
Gets the full name or abbriviated name of this weekday
Gets the day of the week for this date
Gets the day of the week for this date (0=Sunday)
Gets number of days in the month for this date
Gets number of days in the month for this date
Returns the hour field of the date object
Returns the hour field of the date object
Get the Julian date for this date
Get the Julian date for this date
Returns the minute field of the date object
Returns the minute field of the date object
Returns the month field of the date object
Returns the month field of the date object
Gets the full name or abbriviated name of this month
Gets the full name or abbriviated name of this month
Get a Date object for the day after this one
Get a Date object for the day after this one. The time of the returned Date object is the same as this time.
Get a Date object for the weekday after this one
Get a Date object for the weekday after this one. The time of the returned Date object is the same as this time.
Get a Date object for the day before this one
Get a Date object for the day before this one. The time of the returned Date object is the same as this time.
Get a Date object for the weekday before this one
Get a Date object for the weekday before this one. The time of the returned Date object is the same as this time.
Gets the quarter of the year for this date
Gets the quarter of the year for this date
Returns the second field of the date object
Returns the second field of the date object
Get this date/time in Unix time() format
Get a representation of this date in Unix time() format. This may only be valid for dates from 1970 to ~2038.
Gets the week of the year for this date
Gets the week of the year for this date
Gets the number of weeks in the month for this date
Gets the number of weeks in the month for this date
Returns the year field of the date object
Returns the year field of the date object
Tests if this date/time is in DST
Returns true if daylight savings time is in effect for this date in this date's time zone. See Date_TimeZone::inDaylightTime() for compatability information.
Determine if this date is in the future
Determine if this date is in the future
Determine if the year in this date is a leap year
Determine if the year in this date is a leap year
Determine if this date is in the past
Determine if this date is in the past
Set the fields of a Date object based on the input date and format
Set the fields of a Date object based on the input date and format, which is specified by the DATE_FORMAT_* constants.
Set the day field of the date object
Set the day field of the date object, invalid days (not 1-31) are set to 1.
Set the hour field of the date object
Set the hour field of the date object in 24-hour format. Invalid hours (not 0-23) are set to 0.
Set the minute field of the date object
Set the minute field of the date object, invalid minutes (not 0-59) are set to 0.
Set the month field of the date object
Set the month field of the date object, invalid months (not 1-12) are set to 1.
Set the second field of the date object
Set the second field of the date object, invalid seconds (not 0-59) are set to 0.
Sets the time zone of this Date
Sets the time zone of this date with the given Date_TimeZone object. Does not alter the date/time, only assigns a new time zone. For conversion, use convertTZ().
Sets the time zone of this date with the given time zone id
Sets the time zone of this date with the given time zone id, or to the system default if the given id is invalid. Does not alter the date/time, only assigns a new time zone. For conversion, use convertTZ().
Set the year field of the date object
Set the year field of the date object, invalid years (not 0-9999) are set to 0.
Subtracts a given number of seconds from the date
Subtracts a given number of seconds from the date
Subtracts a time span to the date
Subtracts a time span to the date
Converts this date to UTC and sets this date's timezone to UTC
Converts this date to UTC and sets this date's timezone to UTC
Documentation generated on Fri, 10 Dec 2004 18:25:12 +0000 by phpDocumentor 1.3.0RC3