Date (Constructor) [line 153]
object Date Date(
[mixed
$date = null])
|
|
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.
Parameters:
addSeconds [line 636]
void addSeconds(
int
$sec)
|
|
Adds a given number of seconds to the date
Adds a given number of seconds to the date
Parameters:
addSpan [line 649]
void addSpan(
object Date_Span
$span)
|
|
Adds a time span to the date
Adds a time span to the date
Parameters:
after [line 808]
boolean after(
object Date
$when)
|
|
Test if this date/time is after a certian date/time
Test if this date/time is after a certian date/time
Parameters:
before [line 790]
boolean before(
object Date
$when)
|
|
Test if this date/time is before a certain date/time
Test if this date/time is before a certain date/time
Parameters:
compare [line 764]
int compare(
object Date
$d1, object Date
$d2)
|
|
Compares two dates
Compares two dates. Suitable for use in sorting functions.
Parameters:
convertTZ [line 560]
void convertTZ(
object Date_TimeZone
$tz)
|
|
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.
Parameters:
convertTZbyID [line 588]
void convertTZbyID(
string
$id)
|
|
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.
Parameters:
copy [line 272]
void copy(
object Date
$date)
|
|
Copy values from another Date object
Makes this Date a copy of another Date object.
Parameters:
equals [line 826]
boolean equals(
object Date
$when)
|
|
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
Parameters:
format [line 327]
string format(
string
$format)
|
|
Date pretty printing, similar to strftime()
Formats the date in the given format, much like strftime(). Most strftime() options are supported.
formatting options:
%a
abbreviated weekday name (Sun, Mon, Tue)
%A
full weekday name (Sunday, Monday, Tuesday)
%b
abbreviated month name (Jan, Feb, Mar)
%B
full month name (January, February, March)
%C
century number (the year divided by 100 and truncated to an integer, range 00 to 99)
%d
day of month (range 00 to 31)
%D
same as "%m/%d/%y"
%e
day of month, single digit (range 0 to 31)
%E
number of days since unspecified epoch (integer, Date_Calc::dateToDays())
%H
hour as decimal number (00 to 23)
%I
hour as decimal number on 12-hour clock (01 to 12)
%j
day of year (range 001 to 366)
%m
month as decimal number (range 01 to 12)
%M
minute as a decimal number (00 to 59)
%n
newline character (\n)
%O
dst-corrected timezone offset expressed as "+/-HH:MM"
%o
raw timezone offset expressed as "+/-HH:MM"
%p
either 'am' or 'pm' depending on the time
%P
either 'AM' or 'PM' depending on the time
%r
time in am/pm notation, same as "%I:%M:%S %p"
%R
time in 24-hour notation, same as "%H:%M"
%s
seconds including the decimal representation smaller than one second
%S
seconds as a decimal number (00 to 59)
%t
tab character (\t)
%T
current time, same as "%H:%M:%S"
%w
weekday as decimal (0 = Sunday)
%U
week number of current year, first sunday as first week
%y
year as decimal (range 00 to 99)
%Y
year as decimal including century (range 0000 to 9999)
%%
literal '%'
Parameters:
getDate [line 228]
string getDate(
[int
$format = DATE_FORMAT_ISO])
|
|
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.
Parameters:
getDay [line 1105]
Returns the day field of the date object
Returns the day field of the date object
getDayName [line 971]
string getDayName(
[boolean
$abbr = false], [
$length = 3])
|
|
Gets the full name or abbriviated name of this weekday
Gets the full name or abbriviated name of this weekday
Parameters:
getDayOfWeek [line 905]
Gets the day of the week for this date
Gets the day of the week for this date (0=Sunday)
getDaysInMonth [line 944]
Gets number of days in the month for this date
Gets number of days in the month for this date
getHour [line 1118]
Returns the hour field of the date object
Returns the hour field of the date object
getJulianDate [line 892]
Get the Julian date for this date
Get the Julian date for this date
getMinute [line 1131]
Returns the minute field of the date object
Returns the minute field of the date object
getMonth [line 1092]
Returns the month field of the date object
Returns the month field of the date object
getMonthName [line 989]
string getMonthName(
[boolean
$abbr = false])
|
|
Gets the full name or abbriviated name of this month
Gets the full name or abbriviated name of this month
Parameters:
getNextDay [line 1007]
object Date getNextDay(
)
|
|
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.
getNextWeekday [line 1043]
object Date getNextWeekday(
)
|
|
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.
getPrevDay [line 1025]
object Date getPrevDay(
)
|
|
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.
getPrevWeekday [line 1061]
object Date getPrevWeekday(
)
|
|
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.
getQuarterOfYear [line 931]
Gets the quarter of the year for this date
Gets the quarter of the year for this date
getSecond [line 1144]
Returns the second field of the date object
Returns the second field of the date object
getTime [line 469]
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.
getWeekOfYear [line 918]
Gets the week of the year for this date
Gets the week of the year for this date
getWeeksInMonth [line 957]
Gets the number of weeks in the month for this date
Gets the number of weeks in the month for this date
getYear [line 1079]
Returns the year field of the date object
Returns the year field of the date object
inDaylightTime [line 527]
boolean inDaylightTime(
)
|
|
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.
isFuture [line 843]
Determine if this date is in the future
Determine if this date is in the future
isLeapYear [line 879]
Determine if the year in this date is a leap year
Determine if the year in this date is a leap year
isPast [line 861]
Determine if this date is in the past
Determine if this date is in the past
setDate [line 177]
void setDate(
string
$date, [int
$format = DATE_FORMAT_ISO])
|
|
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.
Parameters:
setDay [line 1191]
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.
Parameters:
setHour [line 1209]
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.
Parameters:
setMinute [line 1226]
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.
Parameters:
setMonth [line 1174]
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.
Parameters:
setSecond [line 1243]
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.
Parameters:
setTZ [line 487]
void setTZ(
object Date_TimeZone
$tz)
|
|
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().
Parameters:
setTZbyID [line 508]
void setTZbyID(
string
$id)
|
|
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().
Parameters:
setYear [line 1157]
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.
Parameters:
subtractSeconds [line 697]
void subtractSeconds(
int
$sec)
|
|
Subtracts a given number of seconds from the date
Subtracts a given number of seconds from the date
Parameters:
subtractSpan [line 710]
void subtractSpan(
object Date_Span
$span)
|
|
Subtracts a time span to the date
Subtracts a time span to the date
Parameters:
toUTC [line 539]
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
toUTCbyOffset [line 598]
void toUTCbyOffset(
$offset)
|
|
Parameters: