diff --git a/reference/datetime/book.xml b/reference/datetime/book.xml index 85b3a97ae5..af312ebca3 100644 --- a/reference/datetime/book.xml +++ b/reference/datetime/book.xml @@ -1,5 +1,5 @@ - + @@ -38,7 +38,12 @@ &reference.datetime.setup; &reference.datetime.constants; &reference.datetime.timezones; - + + &reference.datetime.datetime; + &reference.datetime.datetimezone; + &reference.datetime.dateinterval; + &reference.datetime.dateperiod; + &reference.datetime.reference; diff --git a/reference/datetime/constants.xml b/reference/datetime/constants.xml index 392d8ada4b..a7ae6d9acb 100755 --- a/reference/datetime/constants.xml +++ b/reference/datetime/constants.xml @@ -1,135 +1,13 @@ - + &reftitle.constants; - The following constants are defined since PHP 5.1.1 and they offer standard + The DATE_ + constants are defined since PHP 5.1.1 and they offer standard date representations, which can be used along with the date format functions (like date). - - - - DATE_ATOM - (string) - - - - Atom (example: 2005-08-15T15:52:01+00:00) - - - - - - DATE_COOKIE - (string) - - - - HTTP Cookies (example: Monday, 15-Aug-05 15:52:01 UTC) - - - - - - DATE_ISO8601 - (string) - - - - ISO-8601 (example: 2005-08-15T15:52:01+0000) - - - - - - DATE_RFC822 - (string) - - - - RFC 822 (example: Mon, 15 Aug 05 15:52:01 +0000) - - - - - - DATE_RFC850 - (string) - - - - RFC 850 (example: Monday, 15-Aug-05 15:52:01 UTC) - - - - - - DATE_RFC1036 - (string) - - - - RFC 1036 (example: Mon, 15 Aug 05 15:52:01 +0000) - - - - - - DATE_RFC1123 - (string) - - - - RFC 1123 (example: Mon, 15 Aug 2005 15:52:01 +0000) - - - - - - DATE_RFC2822 - (string) - - - - RFC 2822 (Mon, 15 Aug 2005 15:52:01 +0000) - - - - - - DATE_RFC3339 - (string) - - - - Same as DATE_ATOM (since PHP 5.1.3) - - - - - - DATE_RSS - (string) - - - - RSS (Mon, 15 Aug 2005 15:52:01 +0000) - - - - - - DATE_W3C - (string) - - - - World Wide Web Consortium (example: 2005-08-15T15:52:01+00:00) - - - - Following constants exists since PHP 5.1.2 and specify a format returned by functions date_sunrise and diff --git a/reference/datetime/dateinterval.xml b/reference/datetime/dateinterval.xml new file mode 100644 index 0000000000..c74c70e015 --- /dev/null +++ b/reference/datetime/dateinterval.xml @@ -0,0 +1,67 @@ + + + + + + The DateInterval class + DateInterval + + + + +
+ &reftitle.intro; + + Representation of date interval. + +
+ + +
+ &reftitle.classsynopsis; + + + + DateInterval + + + + + DateInterval + + + + + Methods + + + + +
+ +
+ + &reference.datetime.entities.dateinterval; + +
+ + diff --git a/reference/datetime/dateinterval/construct.xml b/reference/datetime/dateinterval/construct.xml new file mode 100644 index 0000000000..766094f627 --- /dev/null +++ b/reference/datetime/dateinterval/construct.xml @@ -0,0 +1,58 @@ + + + + + + DateInterval::__construct + Creates new DateInterval object + + + + &reftitle.description; + + DateInterval::__construct + stringinterval_spec + + + Creates new DateInterval object. + + + + + &reftitle.parameters; + + + + interval_spec + + + Interval specification. + + + + + + + + + + diff --git a/reference/datetime/dateinterval/createfromdatestring.xml b/reference/datetime/dateinterval/createfromdatestring.xml new file mode 100644 index 0000000000..9bc8457cf5 --- /dev/null +++ b/reference/datetime/dateinterval/createfromdatestring.xml @@ -0,0 +1,65 @@ + + + + + + DateInterval::createFromDateString + Sets up a DateInterval from the relative parts of the string + + + + &reftitle.description; + + public static DateIntervalDateInterval::createFromDateString + stringtime + + + Uses the normal date parsers and sets up a DateInterval from the relative parts of the parsed string. + + + + + &reftitle.parameters; + + + + time + + + Date with relative parts. + + + + + + + + + &reftitle.returnvalues; + + Returns new DateInterval instance if success. + + + + + + diff --git a/reference/datetime/dateinterval/format.xml b/reference/datetime/dateinterval/format.xml new file mode 100644 index 0000000000..e2a5df6a6f --- /dev/null +++ b/reference/datetime/dateinterval/format.xml @@ -0,0 +1,54 @@ + + + + + + DateInterval::format + Formats the interval + + + + &reftitle.description; + + public stringDateInterval::format + + + + Formats the interval. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns the formatted interval. + + + + + + diff --git a/reference/datetime/dateperiod.xml b/reference/datetime/dateperiod.xml new file mode 100644 index 0000000000..395433c5dd --- /dev/null +++ b/reference/datetime/dateperiod.xml @@ -0,0 +1,98 @@ + + + + + + The DatePeriod class + DatePeriod + + + + +
+ &reftitle.intro; + + Representation of date period. + +
+ + +
+ &reftitle.classsynopsis; + + + + DatePeriod + + + + + DatePeriod + + + + Traversable + + + + Constants + + const + integer + DatePeriod::EXCLUDE_START_DATE + 1 + + + Methods + + + + +
+ + +
+ &reftitle.constants; +
+ DatePeriod Node Types + + + + DatePeriod::EXCLUDE_START_DATE + + Exclude start date, used in DatePeriod::__construct. + + + + +
+
+ + + +
+ + &reference.datetime.entities.dateperiod; + +
+ + diff --git a/reference/datetime/dateperiod/construct.xml b/reference/datetime/dateperiod/construct.xml new file mode 100644 index 0000000000..c3a1ddaad2 --- /dev/null +++ b/reference/datetime/dateperiod/construct.xml @@ -0,0 +1,113 @@ + + + + + + DatePeriod::__construct + Creates new DatePeriod object + + + + &reftitle.description; + + DatePeriod::__construct + DateTimestart + DateIntervalinterval + intrecurrences + intoptions + + + DatePeriod::__construct + DateTimestart + DateIntervalinterval + DateTimeend + intoptions + + + DatePeriod::__construct + stringisostr + intoptions + + + Creates new DatePeriod object. + + + + + &reftitle.parameters; + + + + start + + + Start date. + + + + + interval + + + Interval. + + + + + recurrences + + + Number of recurrences. + + + + + end + + + End date. + + + + + isostr + + + String containing the ISO interval. + + + + + options + + + Can be set to DateTime::EXCLUDE_START_DATE. + + + + + + + + + + diff --git a/reference/datetime/datetime.xml b/reference/datetime/datetime.xml new file mode 100644 index 0000000000..b023ee0c80 --- /dev/null +++ b/reference/datetime/datetime.xml @@ -0,0 +1,257 @@ + + + + + + The DateTime class + DateTime + + + + +
+ &reftitle.intro; + + Representation of date and time. + +
+ + +
+ &reftitle.classsynopsis; + + + + DateTime + + + + + DateTime + + + + Constants + + const + string + DateTime::ATOM + Y-m-d\TH:i:sP + + + const + string + DateTime::COOKIE + l, d-M-y H:i:s T + + + const + string + DateTime::ISO8601 + Y-m-d\TH:i:sO + + + const + string + DateTime::RFC822 + D, d M y H:i:s O + + + const + string + DateTime::RFC850 + l, d-M-y H:i:s T + + + const + string + DateTime::RFC1036 + D, d M y H:i:s O + + + const + string + DateTime::RFC1123 + D, d M Y H:i:s O + + + const + string + DateTime::RFC2822 + D, d M Y H:i:s O + + + const + string + DateTime::RFC3339 + Y-m-d\TH:i:sP + + + const + string + DateTime::RSS + D, d M Y H:i:s O + + + const + string + DateTime::W3C + Y-m-d\TH:i:sP + + + Methods + + + + +
+ + +
+ &reftitle.constants; +
+ DateTime Node Types + + + + DateTime::ATOM + DATE_ATOM + + + Atom (example: 2005-08-15T15:52:01+00:00) + + + + + + DateTime::COOKIE + DATE_COOKIE + + + HTTP Cookies (example: Monday, 15-Aug-05 15:52:01 UTC) + + + + + + DateTime::ISO8601 + DATE_ISO8601 + + + ISO-8601 (example: 2005-08-15T15:52:01+0000) + + + + + + DateTime::RFC822 + DATE_RFC822 + + + RFC 822 (example: Mon, 15 Aug 05 15:52:01 +0000) + + + + + + DateTime::RFC850 + DATE_RFC850 + + + RFC 850 (example: Monday, 15-Aug-05 15:52:01 UTC) + + + + + + DateTime::RFC1036 + DATE_RFC1036 + + + RFC 1036 (example: Mon, 15 Aug 05 15:52:01 +0000) + + + + + + DateTime::RFC1123 + DATE_RFC1123 + + + RFC 1123 (example: Mon, 15 Aug 2005 15:52:01 +0000) + + + + + + DateTime::RFC2822 + DATE_RFC2822 + + + RFC 2822 (Mon, 15 Aug 2005 15:52:01 +0000) + + + + + + DateTime::RFC3339 + DATE_RFC3339 + + + Same as DATE_ATOM (since PHP 5.1.3) + + + + + + DateTime::RSS + DATE_RSS + + + RSS (Mon, 15 Aug 2005 15:52:01 +0000) + + + + + + DateTime::W3C + DATE_W3C + + + World Wide Web Consortium (example: 2005-08-15T15:52:01+00:00) + + + + + +
+
+ + + +
+ + &reference.datetime.entities.datetime; + +
+ + diff --git a/reference/datetime/datetime/add.xml b/reference/datetime/datetime/add.xml new file mode 100644 index 0000000000..4189dcacb3 --- /dev/null +++ b/reference/datetime/datetime/add.xml @@ -0,0 +1,131 @@ + + + + + + DateTime::add + + Adds an amount of days, months, years, hours, minutes and seconds to a + DateTime object + + + + + &reftitle.description; + + public voidDateTime::add + stringinterval + + + voiddate_add + DateTimeobject + DateIntervalinterval + + + Adds the specified DateInterval object to the + specified DateTime object. + + + + + &reftitle.parameters; + + + &date.datetime.description; + + + interval + + + + The amount to be added. For the date use "P3D", "P3M", "P3Y" or a + combination of the three e.g. "P2M5D" (Y = Years, M = Months, D = Days.) + MUST BE YEAR MONTH DAY FORMAT "P5Y", "P5M2D", "P5Y4D". For the time use + "T3H", "T3M", "T3S" or or a combination of the three e.g. "T5H20M" (H = + Hours, M = Minutes, S = Seconds). For dateTime use "P5D2M4YT5H20M". The + digit before the letter (NOT P or T) can be any amount. + + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.examples; + + + <function>date_add</function> example + +format("d-m-Y H:i:s").'
'; + +date_add($date, new DateInterval("P5D")); +echo '
'.$date->format("d-m-Y").' : 5 Days'; + +date_add($date, new DateInterval("P5M")); +echo '
'.$date->format("d-m-Y").' : 5 Months'; + +date_add($date, new DateInterval("P5Y")); +echo '
'.$date->format("d-m-Y").' : 5 Years'; + +date_add($date, new DateInterval("P5Y5M5D")); +echo '
'.$date->format("d-m-Y").' : 5 Days, 5 Months, 5 Years'; + +date_add($date, new DateInterval("P5YT5H")); +echo '
'.$date->format("d-m-Y H:i:s").' : 5 Years, 5 Hours'; + +?> +]]> +
+
+
+
+ + + &reftitle.notes; + &warn.experimental.func; + + + + &reftitle.seealso; + + + DateTime::sub + DateTime::diff + + + + +
+ + diff --git a/reference/datetime/datetime/construct.xml b/reference/datetime/datetime/construct.xml new file mode 100644 index 0000000000..89cba2acef --- /dev/null +++ b/reference/datetime/datetime/construct.xml @@ -0,0 +1,94 @@ + + + + + + DateTime::__construct + Returns new DateTime object + + + + &reftitle.description; + + DateTime::__construct + stringtime + DateTimeZonetimezone + + + Returns new DateTime object. + + + + + &reftitle.parameters; + + + + time + + + String in a format accepted by strtotime, defaults + to "now". + + + + + timezone + + + Time zone of the time. + + + + + + + + + &reftitle.errors; + + Emits Exception in case of an error. + + + + + &reftitle.examples; + + + <function>DateTime::__construct</function> example + +format(DATE_ATOM); +?> +]]> + + + + + + + + diff --git a/reference/datetime/datetime/createfromformat.xml b/reference/datetime/datetime/createfromformat.xml new file mode 100644 index 0000000000..92c4c0628d --- /dev/null +++ b/reference/datetime/datetime/createfromformat.xml @@ -0,0 +1,83 @@ + + + + + + DateTime::createFromFormat + Returns new DateTime object formatted according to the specified format + + + + &reftitle.description; + + public static DateTimeDateTime::createFromFormat + stringformat + stringtime + DateTimeZonetimezone + + + Returns new DateTime object formatted according to the specified format. + + + + + &reftitle.parameters; + + + + format + + + Format accepted by date. + + + + + time + + + String represeting the time. + + + + + timezone + + + Time zone. + + + + + + + + + &reftitle.returnvalues; + + Returns new DateTime instance. + + + + + + diff --git a/reference/datetime/datetime/diff.xml b/reference/datetime/datetime/diff.xml new file mode 100644 index 0000000000..7756a20141 --- /dev/null +++ b/reference/datetime/datetime/diff.xml @@ -0,0 +1,74 @@ + + + + + + DateTime::diff + Returns the difference between two DateTime objects + + + + &reftitle.description; + + public DateIntervalDateTime::diff + DateTimedatetime + boolabsolute + + + Returns the difference between two DateTime objects. + + + + + &reftitle.parameters; + + + + datetime + + + The date to compare to. + + + + + absolute + + + Whether to return absolute difference. Defaults to &false;. + + + + + + + + + &reftitle.returnvalues; + + The difference between to dates. + + + + + + diff --git a/reference/datetime/datetime/format.xml b/reference/datetime/datetime/format.xml new file mode 100644 index 0000000000..0877d693b5 --- /dev/null +++ b/reference/datetime/datetime/format.xml @@ -0,0 +1,121 @@ + + + + + + DateTime::format + Returns date formatted according to given format + + + + &reftitle.description; + + public stringDateTime::format + stringformat + + + stringdate_format + DateTimeobject + stringformat + + + + + &reftitle.parameters; + + + &date.datetime.description; + + format + + + Format accepted by date. + + + + + + + + + &reftitle.returnvalues; + + Returns formatted date on success or &false; on failure. + + + + + &reftitle.examples; + + + Displaying the date and time using the procedural form + + +]]> + + + + + + Displaying the date and time using the object oriented form + +format('jS, F Y') . "\n"; +echo $datetime->format(DATE_ATOM); +?> +?> +]]> + + &example.outputs; + + + + + + + + + &reftitle.seealso; + + + date + + + + + + + diff --git a/reference/datetime/datetime/getlasterrors.xml b/reference/datetime/datetime/getlasterrors.xml new file mode 100644 index 0000000000..92597cfabf --- /dev/null +++ b/reference/datetime/datetime/getlasterrors.xml @@ -0,0 +1,91 @@ + + + + + + DateTime::getLastErrors + Returns the warnings and errors + + + + &reftitle.description; + + public static arrayDateTime::getLastErrors + + + + Returns the warnings and errors found while parsing a date/time string. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns array containing info about warnings and errors. + + + + + &reftitle.examples; + + + <function>DateTime::getLastErrors</function> example + + +]]> + + &example.outputs; + + 1 + [warnings] => Array + ( + [6] => Double timezone specification + ) + + [error_count] => 1 + [errors] => Array + ( + [0] => The timezone could not be found in the database + ) + +) +]]> + + + + + + + + diff --git a/reference/datetime/datetime/getoffset.xml b/reference/datetime/datetime/getoffset.xml new file mode 100644 index 0000000000..9eca18cf57 --- /dev/null +++ b/reference/datetime/datetime/getoffset.xml @@ -0,0 +1,80 @@ + + + + + + DateTime::getOffset + Returns the daylight saving time offset + + + &reftitle.description; + + public voidDateTime::getOffset + + + + intdate_offset_get + DateTimeobject + + + + + &reftitle.parameters; + + + &date.datetime.description; + + + + + + &reftitle.returnvalues; + + Returns DST offset in seconds on success or &false; on failure. + + + + + &reftitle.examples; + + + Comparing offsets between Summer and Winter + +getOffset(); // Winter offset: 0 +echo $summer->getOffset(); // Summer offset: 3600 = 1 hour +?> +]]> + + + + + + + + diff --git a/reference/datetime/datetime/gettimestamp.xml b/reference/datetime/datetime/gettimestamp.xml new file mode 100644 index 0000000000..7ca522762d --- /dev/null +++ b/reference/datetime/datetime/gettimestamp.xml @@ -0,0 +1,63 @@ + + + + + + DateTime::getTimestamp + Gets the Unix timestamp + + + + &reftitle.description; + + public intDateTime::getTimestamp + + + + Gets the Unix timestamp. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns Unix timestamp representing the date. + + + + + &reftitle.seealso; + + + DateTime::setTimestamp + + + + + + + diff --git a/reference/datetime/datetime/gettimezone.xml b/reference/datetime/datetime/gettimezone.xml new file mode 100644 index 0000000000..3393105984 --- /dev/null +++ b/reference/datetime/datetime/gettimezone.xml @@ -0,0 +1,99 @@ + + + + + + DateTime::getTimezone + Return time zone relative to given DateTime + + + &reftitle.description; + + public DateTimeZoneDateTime::getTimezone + + + + DateTimeZonedate_timezone_get + DateTimeobject + + + + + &reftitle.parameters; + + + &date.datetime.description; + + + + + + &reftitle.returnvalues; + + Returns DateTimeZone object on success or &false; on failure. + + + + + &reftitle.examples; + + + Setting and getting DateTimeZone objects + +getTimezone()->getName() . "\n"; + +$datetime = new DateTime('2008-08-03 12:35:23'); +$la_time = new DateTimeZone('America/Los_Angeles'); +$datetime->setTimezone($la_time); +echo $datetime->getTimezone()->getName(); +?> +]]> + + &example.outputs; + + + + + + + + + &reftitle.seealso; + + + DateTime::timezone_set + timezone_open + + + + + + + diff --git a/reference/datetime/datetime/modify.xml b/reference/datetime/datetime/modify.xml new file mode 100644 index 0000000000..4f3ff0f5d5 --- /dev/null +++ b/reference/datetime/datetime/modify.xml @@ -0,0 +1,104 @@ + + + + + + DateTime::modify + Alters the timestamp + + + &reftitle.description; + + public voidDateTime::modify + stringmodify + + + voiddate_modify + DateTimeobject + stringmodify + + + Alter the timestamp of a DateTime object by incrementing or decrementing in a + format accepted by strtotime. + + + + + &reftitle.parameters; + + + &date.datetime.description; + + modify + + + String in a relative format accepted by strtotime. + + + + + + + + + &reftitle.returnvalues; + + Returns &null; on success or &false; on failure. + + + + + &reftitle.examples; + + + A <function>date_modify</function> example + +modify("+1 day"); +echo $date->format("Y-m-d"); +?> +]]> + + &example.outputs; + + + + + + + + + &reftitle.seealso; + + + strtotime + + + + + + + diff --git a/reference/datetime/datetime/set-state.xml b/reference/datetime/datetime/set-state.xml new file mode 100644 index 0000000000..58271afa25 --- /dev/null +++ b/reference/datetime/datetime/set-state.xml @@ -0,0 +1,54 @@ + + + + + + DateTime::__set_state + The __set_state handler + + + + &reftitle.description; + + public static DateTimeDateTime::__set_state + + + + The __set_state handler. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns a new instance of a DateTime object. + + + + + + diff --git a/reference/datetime/datetime/setdate.xml b/reference/datetime/datetime/setdate.xml new file mode 100644 index 0000000000..2cba5787e8 --- /dev/null +++ b/reference/datetime/datetime/setdate.xml @@ -0,0 +1,144 @@ + + + + + + DateTime::setDate + Sets the date + + + &reftitle.description; + + public voidDateTime::setDate + intyear + intmonth + intday + + + voiddate_date_set + DateTimeobject + intyear + intmonth + intday + + + Resets the current date of the DateTime object to a different date. + + + + + &reftitle.parameters; + + + &date.datetime.description; + + year + + + Year of the date. + + + + + month + + + Month of the date. + + + + + day + + + Day of the date. + + + + + + + + + &reftitle.returnvalues; + + Returns &null; on success or &false; on failure. + + + + + &reftitle.examples; + + + Object oriented example usage + +setDate(2008, 10, 12); + +echo $datetime->format(DATE_RFC2822); +?> +]]> + + + + + + Procedural example usage + + +]]> + + &example.outputs; + + + + + + + + + &reftitle.seealso; + + + DateTime::setISODate + DateTime::setTime + + + + + + + diff --git a/reference/datetime/datetime/setisodate.xml b/reference/datetime/datetime/setisodate.xml new file mode 100644 index 0000000000..2ed4ddf0b4 --- /dev/null +++ b/reference/datetime/datetime/setisodate.xml @@ -0,0 +1,139 @@ + + + + + + DateTime::setISODate + Sets the ISO date + + + &reftitle.description; + + public voidDateTime::setISODate + intyear + intweek + intday + + + voiddate_isodate_set + DateTimeobject + intyear + intweek + intday + + + Set a date according to the ISO 8601 standard - using weeks and day offsets + rather than specific dates. + + + + + &reftitle.parameters; + + + &date.datetime.description; + + year + + + Year of the date. + + + + + week + + + Week of the date. + + + + + day + + + Offset from the first day of the week. + + + + + + + + + &reftitle.returnvalues; + + Returns &null; on success or &false; on failure. + + + + + &reftitle.examples; + + + Finding the date from a week number and day offset + +setISODate(2008, 2, 5); // Day 5 of week 2 of 2008 is the 11th of January. + +// Offset from start of week 2 (7) = 10 +$datetime->setISODate(2008, 2, 10); // Day 10 of week 2 of 2008 is the 16th of January. +?> +]]> + + + + + + Finding the month a week is in + + +]]> + + + + + + + &reftitle.seealso; + + + DateTime::setDate + + + + + + + diff --git a/reference/datetime/datetime/settime.xml b/reference/datetime/datetime/settime.xml new file mode 100644 index 0000000000..a82293b674 --- /dev/null +++ b/reference/datetime/datetime/settime.xml @@ -0,0 +1,139 @@ + + + + + + DateTime::setTime + Sets the time + + + &reftitle.description; + + public voidDateTime::setTime + inthour + intminute + intsecond + + + voiddate_time_set + DateTimeobject + inthour + intminute + intsecond + + + Resets the current time of the DateTime object to a different time. + + + + + &reftitle.parameters; + + + &date.datetime.description; + + hour + + + Hour of the time. + + + + + minute + + + Minute of the time. + + + + + second + + + Second of the time. + + + + + + + + + &reftitle.returnvalues; + + Returns &null; on success or &false; on failure. + + + + + &reftitle.examples; + + + Changing the time of a DateTime object + +format('Y-m-d H:i:s') . "\n"; + +$datetime->setTime(14, 55, 24); +echo $datetime->format('Y-m-d H:i:s') . "\n"; + +// Warning: Does not increment the hour! +// This is because the hour has been set (14) - see date_modify() +$datetime->setTime($datetime->format('H'), $datetime->format('n') + 6); +echo $datetime->format('Y-m-d H:i:s') . "\n"; + +// *Does* increment the day, because the day has not been set +$datetime->setTime($datetime->format('H') + 12, $datetime->format('n')); +echo $datetime->format('Y-m-d H:i:s') . "\n"; +?> +]]> + + &example.outputs; + + + + + + + + + &reftitle.seealso; + + + DateTime::setDate + + + + + + + diff --git a/reference/datetime/datetime/settimestamp.xml b/reference/datetime/datetime/settimestamp.xml new file mode 100644 index 0000000000..746a99af3d --- /dev/null +++ b/reference/datetime/datetime/settimestamp.xml @@ -0,0 +1,74 @@ + + + + + + DateTime::setTimestamp + Sets the date and time based on an Unix timestamp + + + + &reftitle.description; + + public DateTimeDateTime::setTimestamp + intunixtimestamp + + + Sets the date and time based on an Unix timestamp. + + + + + &reftitle.parameters; + + + + unixtimestamp + + + Unix timestamp representing the date. + + + + + + + + + &reftitle.returnvalues; + + Returns the modified DateTime. + + + + + &reftitle.seealso; + + + DateTime::getTimestamp + + + + + + + diff --git a/reference/datetime/datetime/settimezone.xml b/reference/datetime/datetime/settimezone.xml new file mode 100644 index 0000000000..f88b268267 --- /dev/null +++ b/reference/datetime/datetime/settimezone.xml @@ -0,0 +1,108 @@ + + + + + + DateTime::setTimezone + Sets the time zone for the DateTime object + + + &reftitle.description; + + public voidDateTime::setTimezone + DateTimeZonetimezone + + + voiddate_timezone_set + DateTimeobject + DateTimeZonetimezone + + + + + &reftitle.parameters; + + + &date.datetime.description; + + timezone + + + Desired time zone. + + + + + + + + + &reftitle.returnvalues; + + Returns &null; on success or &false; on failure. + + + + + &reftitle.examples; + + + Setting and getting DateTimeZone objects + +getTimezone()->getName() . "\n"; + +$datetime = new DateTime('2008-08-03 12:35:23'); +$la_time = new DateTimeZone('America/Los_Angeles'); +$datetime->setTimezone($la_time); +echo $datetime->getTimezone()->getName(); +?> +]]> + + &example.outputs; + + + + + + + + + &reftitle.seealso; + + + DateTime::getTimezone + timezone_open + + + + + + + diff --git a/reference/datetime/datetime/sub.xml b/reference/datetime/datetime/sub.xml new file mode 100644 index 0000000000..8718950835 --- /dev/null +++ b/reference/datetime/datetime/sub.xml @@ -0,0 +1,131 @@ + + + + + + DateTime::sub + + Subtracts an amount of days, months, years, hours, minutes and seconds from + a DateTime object + + + + + &reftitle.description; + + public voidDateTime::sub + DateIntervalinterval + + + voiddate_sub + DateTimeobject + DateIntervalinterval + + + Subtracts the specified DateInterval object from the specified DateTime + object. + + + + + &reftitle.parameters; + + + &date.datetime.description; + + + interval + + + + The amount to be subtracted. For the date use "P3D", "P3M", "P3Y" or a + combination of the three e.g. "P2M5D" (Y = Years, M = Months, D = Days.) + MUST BE YEAR MONTH DAY FORMAT "P5Y", "P5M2D", "P5Y4D". For the time use + "T3H", "T3M", "T3S" or or a combination of the three e.g. "T5H20M" (H = + Hours, M = Minutes, S = Seconds). For dateTime us "P5D2M4YT5H20M". The + digit before the letter (NOT P or T) can be any amount. + + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.examples; + + + <function>date_sub</function> example + +format("d-m-Y H:i:s").'
'; + +date_sub($date, new DateInterval("P5D")); +echo '
'.$date->format("d-m-Y").' : 5 Days'; + +date_sub($date, new DateInterval("P5M")); +echo '
'.$date->format("d-m-Y").' : 5 Months'; + +date_sub($date, new DateInterval("P5Y")); +echo '
'.$date->format("d-m-Y").' : 5 Years'; + +date_sub($date, new DateInterval("P5Y5M5D")); +echo '
'.$date->format("d-m-Y").' : 5 Days, 5 Months, 5 Years'; + +date_sub($date, new DateInterval("P5YT5H")); +echo '
'.$date->format("d-m-Y H:i:s").' : 5 Years, 5 Hours'; + +?> +]]> +
+
+
+
+ + + &reftitle.notes; + &warn.experimental.func; + + + + &reftitle.seealso; + + + DateTime::add + DateTime::diff + + + + +
+ + diff --git a/reference/datetime/datetime/wakeup.xml b/reference/datetime/datetime/wakeup.xml new file mode 100644 index 0000000000..0450d84c83 --- /dev/null +++ b/reference/datetime/datetime/wakeup.xml @@ -0,0 +1,54 @@ + + + + + + DateTime::__wakeup + The __wakeup handler + + + + &reftitle.description; + + public DateTimeDateTime::__wakeup + + + + The __wakeup handler. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Initializes a DateTime object. + + + + + + diff --git a/reference/datetime/datetimezone.xml b/reference/datetime/datetimezone.xml new file mode 100644 index 0000000000..771b965ba1 --- /dev/null +++ b/reference/datetime/datetimezone.xml @@ -0,0 +1,263 @@ + + + + + + The DateTimeZone class + DateTimeZone + + + + +
+ &reftitle.intro; + + Representation of time zone. + +
+ + +
+ &reftitle.classsynopsis; + + + + DateTimeZone + + + + + DateTimeZone + + + + Constants + + const + integer + DateTimeZone::AFRICA + 1 + + + const + integer + DateTimeZone::AMERICA + 2 + + + const + integer + DateTimeZone::ANTARCTICA + 4 + + + const + integer + DateTimeZone::ARCTIC + 8 + + + const + integer + DateTimeZone::ASIA + 16 + + + const + integer + DateTimeZone::ATLANTIC + 32 + + + const + integer + DateTimeZone::AUSTRALIA + 64 + + + const + integer + DateTimeZone::EUROPE + 128 + + + const + integer + DateTimeZone::INDIAN + 256 + + + const + integer + DateTimeZone::PACIFIC + 512 + + + const + integer + DateTimeZone::UTC + 1024 + + + const + integer + DateTimeZone::ALL + 2047 + + + const + integer + DateTimeZone::ALL_WITH_BC + 4095 + + + const + integer + DateTimeZone::PER_COUNTRY + 4096 + + + Methods + + + + +
+ + +
+ &reftitle.constants; +
+ DateTimeZone Node Types + + + + DateTimeZone::AFRICA + + Africa time zones. + + + + + DateTimeZone::AMERICA + + America time zones. + + + + + DateTimeZone::ANTARCTICA + + Antarctica time zones. + + + + + DateTimeZone::ARCTIC + + Artic time zones. + + + + + DateTimeZone::ASIA + + Asia time zones. + + + + + DateTimeZone::ATLANTIC + + Atlantic time zones. + + + + + DateTimeZone::AUSTRALIA + + Australia time zones. + + + + + DateTimeZone::EUROPE + + Europe time zones. + + + + + DateTimeZone::INDIAN + + Indian time zones. + + + + + DateTimeZone::PACIFIC + + Pacific time zones. + + + + + DateTimeZone::UTC + + UTC time zones. + + + + + DateTimeZone::ALL + + All time zones. + + + + + DateTimeZone::ALL_WITH_BC + + All time zones including backwards compatible. + + + + + DateTimeZone::PER_COUNTRY + + Time zones per country. + + + + +
+
+ + + +
+ + &reference.datetime.entities.datetimezone; + +
+ + diff --git a/reference/datetime/datetimezone/construct.xml b/reference/datetime/datetimezone/construct.xml new file mode 100644 index 0000000000..756f7809c2 --- /dev/null +++ b/reference/datetime/datetimezone/construct.xml @@ -0,0 +1,58 @@ + + + + + + DateTimeZone::__construct + Creates new DateTimeZone object + + + + &reftitle.description; + + DateTimeZone::__construct + stringtimezone + + + Creates new DateTimeZone object. + + + + + &reftitle.parameters; + + + + timezone + + + One of timezones. + + + + + + + + + + diff --git a/reference/datetime/datetimezone/getlocation.xml b/reference/datetime/datetimezone/getlocation.xml new file mode 100644 index 0000000000..f0a5f6aac0 --- /dev/null +++ b/reference/datetime/datetimezone/getlocation.xml @@ -0,0 +1,83 @@ + + + + + + DateTimeZone::getLocation + Returns location information for a timezone + + + + &reftitle.description; + + public arrayDateTimeZone::getLocation + + + + Returns location information for a timezone, including country code, latitude/longitude and comments. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Array containing location information about timezone. + + + + + &reftitle.examples; + + + <function>DateTimeZone::getLocation</function> example + +getLocation()); +?> +]]> + + &example.outputs; + + CZ + [latitude] => 50.08333 + [longitude] => 14.43333 + [comments] => +) +]]> + + + + + + + + diff --git a/reference/datetime/datetimezone/getname.xml b/reference/datetime/datetimezone/getname.xml new file mode 100644 index 0000000000..4948268eb0 --- /dev/null +++ b/reference/datetime/datetimezone/getname.xml @@ -0,0 +1,54 @@ + + + + + + DateTimeZone::getName + Returns the name of the timezone + + + + &reftitle.description; + + public stringDateTimeZone::getName + + + + Returns the name of the timezone. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + One of timezones. + + + + + + diff --git a/reference/datetime/datetimezone/getoffset.xml b/reference/datetime/datetimezone/getoffset.xml new file mode 100644 index 0000000000..0913dbd675 --- /dev/null +++ b/reference/datetime/datetimezone/getoffset.xml @@ -0,0 +1,104 @@ + + + + + + DateTimeZone::getOffset + Returns the timezone offset from GMT + + + &reftitle.description; + + intDateTimeZone::getOffset + DateTimedatetime + + + inttimezone_offset_get + DateTimeZoneobject + DateTimedatetime + + + This function returns the offset to GMT for the date/time specified in the + datetime parameter. The GMT offset is calculated + with the timezone information contained in the DateTime object being used. + + + + + &reftitle.parameters; + + + &date.datetimezone.description; + + datetime + + + DateTime that contains the date/time to compute the offset from. + + + + + + + + + &reftitle.returnvalues; + + Returns time zone offset in seconds on success or &false; on failure. + + + + + &reftitle.examples; + + + <function>timezone_offset_get</function> examples + +getOffset($dateTimeTaipei); + +// Should show int(32400) (for dates after Sat Sep 8 01:00:00 1951 JST). +var_dump($timeOffset); +?> +]]> + + + + + + + + diff --git a/reference/datetime/datetimezone/gettransitions.xml b/reference/datetime/datetimezone/gettransitions.xml new file mode 100644 index 0000000000..78d71a0afd --- /dev/null +++ b/reference/datetime/datetimezone/gettransitions.xml @@ -0,0 +1,108 @@ + + + + + + DateTimeZone::getTransitions + Returns all transitions for the timezone + + + &reftitle.description; + + arrayDateTimeZone::getTransitions + inttimestamp_begin + inttimestamp_end + + + arraytimezone_transitions_get + DateTimeZoneobject + inttimestamp_begin + inttimestamp_end + + + + + &reftitle.parameters; + + + &date.datetimezone.description; + + timestamp_begin + + + Begin timestamp. + + + + + timestamp_end + + + End timestamp. + + + + + + + + + &reftitle.returnvalues; + + Returns numerically indexed array containing associative array with all + transitions on success or &false; on failure. + + + + + &reftitle.examples; + + + A <function>timezone_transitions_get</function> example + +getTransitions())); +?> +]]> + + &example.outputs.similar; + + -1693706400 + [time] => 1916-04-30T22:00:00+0000 + [offset] => 7200 + [isdst] => 1 + [abbr] => CEST +) +]]> + + + + + + + + diff --git a/reference/datetime/datetimezone/listabbreviations.xml b/reference/datetime/datetimezone/listabbreviations.xml new file mode 100644 index 0000000000..0f421b8fae --- /dev/null +++ b/reference/datetime/datetimezone/listabbreviations.xml @@ -0,0 +1,111 @@ + + + + + + DateTimeZone::listAbbreviations + Returns associative array containing dst, offset and the timezone name + + + &reftitle.description; + + arrayDateTimeZone::listAbbreviations + + + + arraytimezone_abbreviations_list + + + + + + &reftitle.returnvalues; + + Returns array on success or &false; on failure. + + + + + &reftitle.examples; + + + A <function>timezone_abbreviations_list</function> example + + +]]> + + &example.outputs.similar; + + Array + ( + [dst] => 1 + [offset] => -14400 + [timezone_id] => America/Porto_Acre + ) + + [1] => Array + ( + [dst] => 1 + [offset] => -14400 + [timezone_id] => America/Eirunepe + ) + + [2] => Array + ( + [dst] => 1 + [offset] => -14400 + [timezone_id] => America/Rio_Branco + ) + + [3] => Array + ( + [dst] => 1 + [offset] => -14400 + [timezone_id] => Brazil/Acre + ) + +) +]]> + + + + + + + &reftitle.seealso; + + + timezone_identifiers_list + + + + + + + diff --git a/reference/datetime/datetimezone/listidentifiers.xml b/reference/datetime/datetimezone/listidentifiers.xml new file mode 100644 index 0000000000..c3e2036807 --- /dev/null +++ b/reference/datetime/datetimezone/listidentifiers.xml @@ -0,0 +1,115 @@ + + + + + + DateTimeZone::listIdentifiers + Returns numerically index array with all timezone identifiers + + + &reftitle.description; + + arrayDateTimeZone::listIdentifiers + intwhat + stringcountry + + + arraytimezone_identifiers_list + intwhat + stringoption + + + + + &reftitle.parameters; + + + &date.datetime.description; + + what + + + One of DateTimeZone class constants, defaults to + DateTimeZone::ALL. + + + + + country + + + A two-letter ISO 3166-1 compatible country code. + + + + + + + + + &reftitle.returnvalues; + + Returns array on success or &false; on failure. + + + + + &reftitle.examples; + + + A <function>timezone_identifiers_list</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + timezone_abbreviations_list + + + + + + + diff --git a/reference/datetime/functions/date-add.xml b/reference/datetime/functions/date-add.xml index 2bd6188853..1ba27336b5 100644 --- a/reference/datetime/functions/date-add.xml +++ b/reference/datetime/functions/date-add.xml @@ -1,104 +1,15 @@ - + date_add - - Adds an amount of days, months, years, hours, minutes and seconds to a - DateTime object - + &Alias; DateTime::add &reftitle.description; - - voiddate_add - DateTimeobject - DateIntervalinterval - - Adds the specified DateInterval object to the - specified DateTime object. - - - - - &reftitle.parameters; - - - &date.datetime.description; - - - interval - - - - The amount to be added. For the date use "P3D", "P3M", "P3Y" or a - combination of the three e.g. "P2M5D" (Y = Years, M = Months, D = Days.) - MUST BE YEAR MONTH DAY FORMAT "P5Y", "P5M2D", "P5Y4D". For the time use - "T3H", "T3M", "T3S" or or a combination of the three e.g. "T5H20M" (H = - Hours, M = Minutes, S = Seconds). For dateTime use "P5D2M4YT5H20M". The - digit before the letter (NOT P or T) can be any amount. - - - - - - - - - &reftitle.returnvalues; - - &return.void; - - - - - &reftitle.examples; - - - <function>date_add</function> example - -format("d-m-Y H:i:s").'
'; - -date_add($date, new DateInterval("P5D")); -echo '
'.$date->format("d-m-Y").' : 5 Days'; - -date_add($date, new DateInterval("P5M")); -echo '
'.$date->format("d-m-Y").' : 5 Months'; - -date_add($date, new DateInterval("P5Y")); -echo '
'.$date->format("d-m-Y").' : 5 Years'; - -date_add($date, new DateInterval("P5Y5M5D")); -echo '
'.$date->format("d-m-Y").' : 5 Days, 5 Months, 5 Years'; - -date_add($date, new DateInterval("P5YT5H")); -echo '
'.$date->format("d-m-Y H:i:s").' : 5 Years, 5 Hours'; - -?> -]]> -
-
-
-
- - - &reftitle.notes; - &warn.experimental.func; - - - - &reftitle.seealso; - - - date_sub - date_diff - + &info.function.alias; DateTime::add diff --git a/reference/datetime/functions/date-create-from-format.xml b/reference/datetime/functions/date-create-from-format.xml new file mode 100644 index 0000000000..491680d1c4 --- /dev/null +++ b/reference/datetime/functions/date-create-from-format.xml @@ -0,0 +1,38 @@ + + + + + + date_create_from_format + &Alias; DateTime::createFromFormat + + + + &reftitle.description; + + &info.function.alias; DateTime::createFromFormat + + + + + + diff --git a/reference/datetime/functions/date-create.xml b/reference/datetime/functions/date-create.xml index d26ee0b6b5..71245748ce 100644 --- a/reference/datetime/functions/date-create.xml +++ b/reference/datetime/functions/date-create.xml @@ -1,5 +1,5 @@ - + date_create @@ -13,11 +13,6 @@ stringtime DateTimeZonetimezone - - DateTimeDateTime::__construct - stringtime - DateTimeZonetimezone - @@ -56,22 +51,7 @@ &reftitle.examples; - Object oriented style - -format(DATE_ATOM); -?> -]]> - - - - - - Procedural style + <function>date_create</function> example - + date_date_set - Sets the date + &Alias; DateTime::setDate + &reftitle.description; - - voiddate_date_set - DateTimeobject - intyear - intmonth - intday - - - voidDateTime::setDate - intyear - intmonth - intday - - Resets the current date of the DateTime object to a different date. - - - - - &reftitle.parameters; - - - &date.datetime.description; - - year - - - Year of the date. - - - - - month - - - Month of the date. - - - - - day - - - Day of the date. - - - - - - - - - &reftitle.returnvalues; - - Returns &null; on success or &false; on failure. - - - - - &reftitle.examples; - - - Object oriented example usage - -setDate(2008, 10, 12); - -echo $datetime->format(DATE_RFC2822); -?> -]]> - - - - - - Procedural example usage - - -]]> - - &example.outputs; - - - - - - - - - &reftitle.seealso; - - - date_isodate_set - date_time_set - + &info.function.alias; DateTime::setDate diff --git a/reference/datetime/functions/date-diff.xml b/reference/datetime/functions/date-diff.xml new file mode 100644 index 0000000000..f850f82e5c --- /dev/null +++ b/reference/datetime/functions/date-diff.xml @@ -0,0 +1,38 @@ + + + + + + date_diff + &Alias; DateTime::diff + + + + &reftitle.description; + + &info.function.alias; DateTime::diff + + + + + + diff --git a/reference/datetime/functions/date-format.xml b/reference/datetime/functions/date-format.xml index 8f3ede30a1..79179edece 100644 --- a/reference/datetime/functions/date-format.xml +++ b/reference/datetime/functions/date-format.xml @@ -1,97 +1,15 @@ - + date_format - Returns date formatted according to given format + &Alias; DateTime::format + &reftitle.description; - - stringdate_format - DateTimeobject - stringformat - - - stringDateTime::format - stringformat - - - - - &reftitle.parameters; - - &date.datetime.description; - - format - - - Format accepted by date. - - - - - - - - - &reftitle.returnvalues; - - Returns formatted date on success or &false; on failure. - - - - - &reftitle.examples; - - - Displaying the date and time using the procedural form - - -]]> - - - - - - Displaying the date and time using the object oriented form - -format('jS, F Y') . "\n"; -echo $datetime->format(DATE_ATOM); -?> -?> -]]> - - &example.outputs; - - - - - - - - - &reftitle.seealso; - - - date - + &info.function.alias; DateTime::format diff --git a/reference/datetime/functions/date-get-last-errors.xml b/reference/datetime/functions/date-get-last-errors.xml new file mode 100644 index 0000000000..95f8ced2c2 --- /dev/null +++ b/reference/datetime/functions/date-get-last-errors.xml @@ -0,0 +1,38 @@ + + + + + + date_get_last_errors + &Alias; DateTime::getLastErrors + + + + &reftitle.description; + + &info.function.alias; DateTime::getLastErrors + + + + + + diff --git a/reference/datetime/functions/date-interval-create-from-date-string.xml b/reference/datetime/functions/date-interval-create-from-date-string.xml new file mode 100644 index 0000000000..50a8a0adb7 --- /dev/null +++ b/reference/datetime/functions/date-interval-create-from-date-string.xml @@ -0,0 +1,38 @@ + + + + + + date_interval_create_from_date_string + &Alias; DateInterval::createFromDateString + + + + &reftitle.description; + + &info.function.alias; DateInterval::createFromDateString + + + + + + diff --git a/reference/datetime/functions/date-interval-format.xml b/reference/datetime/functions/date-interval-format.xml new file mode 100644 index 0000000000..e357e230ce --- /dev/null +++ b/reference/datetime/functions/date-interval-format.xml @@ -0,0 +1,38 @@ + + + + + + date_interval_format + &Alias; DateInterval::format + + + + &reftitle.description; + + &info.function.alias; DateInterval::format + + + + + + diff --git a/reference/datetime/functions/date-isodate-set.xml b/reference/datetime/functions/date-isodate-set.xml index c57142a4f2..78432650d1 100644 --- a/reference/datetime/functions/date-isodate-set.xml +++ b/reference/datetime/functions/date-isodate-set.xml @@ -1,116 +1,15 @@ - + date_isodate_set - Sets the ISO date + &Alias; DateTime::setISODate + &reftitle.description; - - voiddate_isodate_set - DateTimeobject - intyear - intweek - intday - - - voidDateTime::setISODate - intyear - intweek - intday - - Set a date according to the ISO 8601 standard - using weeks and day offsets - rather than specific dates. - - - - - &reftitle.parameters; - - - &date.datetime.description; - - year - - - Year of the date. - - - - - week - - - Week of the date. - - - - - day - - - Offset from the first day of the week. - - - - - - - - - &reftitle.returnvalues; - - Returns &null; on success or &false; on failure. - - - - - &reftitle.examples; - - - Finding the date from a week number and day offset - -setISODate(2008, 2, 5); // Day 5 of week 2 of 2008 is the 11th of January. - -// Offset from start of week 2 (7) = 10 -$datetime->setISODate(2008, 2, 10); // Day 10 of week 2 of 2008 is the 16th of January. -?> -]]> - - - - - - Finding the month a week is in - - -]]> - - - - - - - &reftitle.seealso; - - - date_date_set - + &info.function.alias; DateTime::setISODate diff --git a/reference/datetime/functions/date-modify.xml b/reference/datetime/functions/date-modify.xml index 3ad911c1d5..7880e9675b 100644 --- a/reference/datetime/functions/date-modify.xml +++ b/reference/datetime/functions/date-modify.xml @@ -1,81 +1,15 @@ - + date_modify - Alters the timestamp + &Alias; DateTime::modify + &reftitle.description; - - voiddate_modify - DateTimeobject - stringmodify - - - voidDateTime::modify - stringmodify - - Alter the timestamp of a DateTime object by incrementing or decrementing in a - format accepted by strtotime. - - - - - &reftitle.parameters; - - - &date.datetime.description; - - modify - - - String in a relative format accepted by strtotime. - - - - - - - - - &reftitle.returnvalues; - - Returns &null; on success or &false; on failure. - - - - - &reftitle.examples; - - - A <function>date_modify</function> example - -modify("+1 day"); -echo $date->format("Y-m-d"); -?> -]]> - - &example.outputs; - - - - - - - - - &reftitle.seealso; - - - strtotime - + &info.function.alias; DateTime::modify diff --git a/reference/datetime/functions/date-offset-get.xml b/reference/datetime/functions/date-offset-get.xml index 408b061cec..f937f794ba 100644 --- a/reference/datetime/functions/date-offset-get.xml +++ b/reference/datetime/functions/date-offset-get.xml @@ -1,57 +1,15 @@ - + date_offset_get - Returns the daylight saving time offset + &Alias; DateTime::getOffset + &reftitle.description; - - intdate_offset_get - DateTimeobject - - - intDateTime::getOffset - - - - - - &reftitle.parameters; - - &date.datetime.description; - - - - - - &reftitle.returnvalues; - - Returns DST offset in seconds on success or &false; on failure. - - - - - &reftitle.examples; - - - Comparing offsets between Summer and Winter - -getOffset(); // Winter offset: 0 -echo $summer->getOffset(); // Summer offset: 3600 = 1 hour -?> -]]> - - + &info.function.alias; DateTime::getOffset diff --git a/reference/datetime/functions/date-parse-from-format.xml b/reference/datetime/functions/date-parse-from-format.xml new file mode 100644 index 0000000000..26a09b7d95 --- /dev/null +++ b/reference/datetime/functions/date-parse-from-format.xml @@ -0,0 +1,121 @@ + + + + + + date_parse_from_format + Get info about given date + + + + &reftitle.description; + + arraydate_parse_from_format + stringformat + stringdate + + + Returns associative array with detailed info about given date. + + + + + &reftitle.parameters; + + + + format + + + Format accepted by date with some extras. + + + + + date + + + String representing the date. + + + + + + + + + &reftitle.returnvalues; + + + Returns associative array with detailed info about given date. + + + + + &reftitle.examples; + + + <function>date_parse_from_format</function> example + + +]]> + + &example.outputs; + + 2009 + [month] => 1 + [day] => 6 + [hour] => 13 + [minute] => 0 + [second] => 0 + [fraction] => + [warning_count] => 0 + [warnings] => Array + ( + ) + + [error_count] => 0 + [errors] => Array + ( + ) + + [is_localtime] => 1 + [zone_type] => 1 + [zone] => -60 + [is_dst] => +) +]]> + + + + + + + + diff --git a/reference/datetime/functions/date-sub.xml b/reference/datetime/functions/date-sub.xml index fa49687e50..496c6cc747 100644 --- a/reference/datetime/functions/date-sub.xml +++ b/reference/datetime/functions/date-sub.xml @@ -1,104 +1,15 @@ - + date_sub - - Subtracts an amount of days, months, years, hours, minutes and seconds from - a DateTime object - + &Alias; DateTime::sub &reftitle.description; - - voiddate_sub - DateTimeobject - DateIntervalinterval - - Subtracts the specified DateInterval object from the specified DateTime - object. - - - - - &reftitle.parameters; - - - &date.datetime.description; - - - interval - - - - The amount to be subtracted. For the date use "P3D", "P3M", "P3Y" or a - combination of the three e.g. "P2M5D" (Y = Years, M = Months, D = Days.) - MUST BE YEAR MONTH DAY FORMAT "P5Y", "P5M2D", "P5Y4D". For the time use - "T3H", "T3M", "T3S" or or a combination of the three e.g. "T5H20M" (H = - Hours, M = Minutes, S = Seconds). For dateTime us "P5D2M4YT5H20M". The - digit before the letter (NOT P or T) can be any amount. - - - - - - - - - &reftitle.returnvalues; - - &return.void; - - - - - &reftitle.examples; - - - <function>date_sub</function> example - -format("d-m-Y H:i:s").'
'; - -date_sub($date, new DateInterval("P5D")); -echo '
'.$date->format("d-m-Y").' : 5 Days'; - -date_sub($date, new DateInterval("P5M")); -echo '
'.$date->format("d-m-Y").' : 5 Months'; - -date_sub($date, new DateInterval("P5Y")); -echo '
'.$date->format("d-m-Y").' : 5 Years'; - -date_sub($date, new DateInterval("P5Y5M5D")); -echo '
'.$date->format("d-m-Y").' : 5 Days, 5 Months, 5 Years'; - -date_sub($date, new DateInterval("P5YT5H")); -echo '
'.$date->format("d-m-Y H:i:s").' : 5 Years, 5 Hours'; - -?> -]]> -
-
-
-
- - - &reftitle.notes; - &warn.experimental.func; - - - - &reftitle.seealso; - - - date_add - date_diff - + &info.function.alias; DateTime::sub diff --git a/reference/datetime/functions/date-time-set.xml b/reference/datetime/functions/date-time-set.xml index c5a1674851..c81d628e10 100644 --- a/reference/datetime/functions/date-time-set.xml +++ b/reference/datetime/functions/date-time-set.xml @@ -1,116 +1,15 @@ - + date_time_set - Sets the time + &Alias; DateTime::setTime + &reftitle.description; - - voiddate_time_set - DateTimeobject - inthour - intminute - intsecond - - - voidDateTime::setTime - inthour - intminute - intsecond - - Resets the current time of the DateTime object to a different time. - - - - - &reftitle.parameters; - - - &date.datetime.description; - - hour - - - Hour of the time. - - - - - minute - - - Minute of the time. - - - - - second - - - Second of the time. - - - - - - - - - &reftitle.returnvalues; - - Returns &null; on success or &false; on failure. - - - - - &reftitle.examples; - - - Changing the time of a DateTime object - -format('Y-m-d H:i:s') . "\n"; - -$datetime->setTime(14, 55, 24); -echo $datetime->format('Y-m-d H:i:s') . "\n"; - -// Warning: Does not increment the hour! -// This is because the hour has been set (14) - see date_modify() -$datetime->setTime($datetime->format('H'), $datetime->format('n') + 6); -echo $datetime->format('Y-m-d H:i:s') . "\n"; - -// *Does* increment the day, because the day has not been set -$datetime->setTime($datetime->format('H') + 12, $datetime->format('n')); -echo $datetime->format('Y-m-d H:i:s') . "\n"; -?> -]]> - - &example.outputs; - - - - - - - - - &reftitle.seealso; - - - date_date_set - + &info.function.alias; DateTime::setTime diff --git a/reference/datetime/functions/date-timestamp-get.xml b/reference/datetime/functions/date-timestamp-get.xml new file mode 100644 index 0000000000..c4b2905a37 --- /dev/null +++ b/reference/datetime/functions/date-timestamp-get.xml @@ -0,0 +1,38 @@ + + + + + + date_timestamp_get + &Alias; DateTime::getTimestamp + + + + &reftitle.description; + + &info.function.alias; DateTime::getTimestamp + + + + + + diff --git a/reference/datetime/functions/date-timestamp-set.xml b/reference/datetime/functions/date-timestamp-set.xml new file mode 100644 index 0000000000..d69f808860 --- /dev/null +++ b/reference/datetime/functions/date-timestamp-set.xml @@ -0,0 +1,38 @@ + + + + + + date_timestamp_set + &Alias; DateTime::setTimestamp + + + + &reftitle.description; + + &info.function.alias; DateTime::setTimestamp + + + + + + diff --git a/reference/datetime/functions/date-timezone-get.xml b/reference/datetime/functions/date-timezone-get.xml index 96f27b03db..1fc8986e4a 100644 --- a/reference/datetime/functions/date-timezone-get.xml +++ b/reference/datetime/functions/date-timezone-get.xml @@ -1,76 +1,15 @@ - + date_timezone_get - Return time zone relative to given DateTime + &Alias; DateTime::getTimezone + &reftitle.description; - - DateTimeZonedate_timezone_get - DateTimeobject - - - DateTimeZoneDateTime::getTimezone - - - - - - &reftitle.parameters; - - &date.datetime.description; - - - - - - &reftitle.returnvalues; - - Returns DateTimeZone object on success or &false; on failure. - - - - - &reftitle.examples; - - - Setting and getting DateTimeZone objects - -getTimezone()->getName() . "\n"; - -$datetime = new DateTime('2008-08-03 12:35:23'); -$la_time = new DateTimeZone('America/Los_Angeles'); -$datetime->setTimezone($la_time); -echo $datetime->getTimezone()->getName(); -?> -]]> - - &example.outputs; - - - - - - - - - &reftitle.seealso; - - - date_timezone_set - timezone_open - + &info.function.alias; DateTime::getTimezone diff --git a/reference/datetime/functions/date-timezone-set.xml b/reference/datetime/functions/date-timezone-set.xml index 80a4f4c5ea..66931f78ce 100644 --- a/reference/datetime/functions/date-timezone-set.xml +++ b/reference/datetime/functions/date-timezone-set.xml @@ -1,85 +1,15 @@ - + date_timezone_set - Sets the time zone for the DateTime object + &Alias; DateTime::setTimezone + &reftitle.description; - - voiddate_timezone_set - DateTimeobject - DateTimeZonetimezone - - - voidDateTime::setTimezone - DateTimeZonetimezone - - - - - &reftitle.parameters; - - &date.datetime.description; - - timezone - - - Desired time zone. - - - - - - - - - &reftitle.returnvalues; - - Returns &null; on success or &false; on failure. - - - - - &reftitle.examples; - - - Setting and getting DateTimeZone objects - -getTimezone()->getName() . "\n"; - -$datetime = new DateTime('2008-08-03 12:35:23'); -$la_time = new DateTimeZone('America/Los_Angeles'); -$datetime->setTimezone($la_time); -echo $datetime->getTimezone()->getName(); -?> -]]> - - &example.outputs; - - - - - - - - - &reftitle.seealso; - - - date_timezone_get - timezone_open - + &info.function.alias; DateTime::setTimezone diff --git a/reference/datetime/functions/timezone-abbreviations-list.xml b/reference/datetime/functions/timezone-abbreviations-list.xml index d23b0f9c2a..ccedba822a 100644 --- a/reference/datetime/functions/timezone-abbreviations-list.xml +++ b/reference/datetime/functions/timezone-abbreviations-list.xml @@ -1,88 +1,15 @@ - + timezone_abbreviations_list - Returns associative array containing dst, offset and the timezone name + &Alias; DateTimeZone::listAbbreviations + &reftitle.description; - - arraytimezone_abbreviations_list - - - - arrayDateTimeZone::listAbbreviations - - - - - - &reftitle.returnvalues; - Returns array on success or &false; on failure. - - - - - &reftitle.examples; - - - A <function>timezone_abbreviations_list</function> example - - -]]> - - &example.outputs.similar; - - Array - ( - [dst] => 1 - [offset] => -14400 - [timezone_id] => America/Porto_Acre - ) - - [1] => Array - ( - [dst] => 1 - [offset] => -14400 - [timezone_id] => America/Eirunepe - ) - - [2] => Array - ( - [dst] => 1 - [offset] => -14400 - [timezone_id] => America/Rio_Branco - ) - - [3] => Array - ( - [dst] => 1 - [offset] => -14400 - [timezone_id] => Brazil/Acre - ) - -) -]]> - - - - - - - &reftitle.seealso; - - - timezone_identifiers_list - + &info.function.alias; DateTimeZone::listAbbreviations diff --git a/reference/datetime/functions/timezone-identifiers-list.xml b/reference/datetime/functions/timezone-identifiers-list.xml index ac4b19423b..d86f96a7a6 100644 --- a/reference/datetime/functions/timezone-identifiers-list.xml +++ b/reference/datetime/functions/timezone-identifiers-list.xml @@ -1,92 +1,15 @@ - + timezone_identifiers_list - Returns numerically index array with all timezone identifiers + &Alias; DateTimeZone::listIdentifiers + &reftitle.description; - - arraytimezone_identifiers_list - intwhat - stringoption - - - arrayDateTimeZone::listIdentifiers - intwhat - stringcountry - - - - - &reftitle.parameters; - - &date.datetime.description; - - what - - - One of DateTimeZone class constants, defaults to - DateTimeZone::ALL. - - - - - country - - - A two-letter ISO 3166-1 compatible country code. - - - - - - - - - &reftitle.returnvalues; - - Returns array on success or &false; on failure. - - - - - &reftitle.examples; - - - A <function>timezone_identifiers_list</function> example - - -]]> - - &example.outputs.similar; - - - - - - - - - &reftitle.seealso; - - - timezone_abbreviations_list - + &info.function.alias; DateTimeZone::listIdentifiers diff --git a/reference/datetime/functions/timezone-location-get.xml b/reference/datetime/functions/timezone-location-get.xml new file mode 100644 index 0000000000..df45720a16 --- /dev/null +++ b/reference/datetime/functions/timezone-location-get.xml @@ -0,0 +1,38 @@ + + + + + + timezone_location_get + &Alias; DateTimeZone::getLocation + + + + &reftitle.description; + + &info.function.alias; DateTimeZone::getLocation + + + + + + diff --git a/reference/datetime/functions/timezone-name-get.xml b/reference/datetime/functions/timezone-name-get.xml index c6c3c79c21..e4e06ba0cc 100644 --- a/reference/datetime/functions/timezone-name-get.xml +++ b/reference/datetime/functions/timezone-name-get.xml @@ -1,35 +1,15 @@ - + timezone_name_get - Returns the name of the timezone + &Alias; DateTimeZone::getName + &reftitle.description; - - stringtimezone_name_get - DateTimeZoneobject - - - stringDateTimeZone::getName - - - - - - &reftitle.parameters; - - &date.datetimezone.description; - - - - - - &reftitle.returnvalues; - - Returns time zone name on success or &false; on failure. + &info.function.alias; DateTimeZone::getName diff --git a/reference/datetime/functions/timezone-offset-get.xml b/reference/datetime/functions/timezone-offset-get.xml index dd410e1f1c..349f2350cb 100644 --- a/reference/datetime/functions/timezone-offset-get.xml +++ b/reference/datetime/functions/timezone-offset-get.xml @@ -1,81 +1,15 @@ - + timezone_offset_get - Returns the timezone offset from GMT + &Alias; DateTimeZone::getOffset + &reftitle.description; - - inttimezone_offset_get - DateTimeZoneobject - DateTimedatetime - - - intDateTimeZone::getOffset - DateTimedatetime - - This function returns the offset to GMT for the date/time specified in the - datetime parameter. The GMT offset is calculated - with the timezone information contained in the DateTime object being used. - - - - - &reftitle.parameters; - - - &date.datetimezone.description; - - datetime - - - DateTime that contains the date/time to compute the offset from. - - - - - - - - - &reftitle.returnvalues; - - Returns time zone offset in seconds on success or &false; on failure. - - - - - &reftitle.examples; - - - <function>timezone_offset_get</function> examples - -getOffset($dateTimeTaipei); - -// Should show int(32400) (for dates after Sat Sep 8 01:00:00 1951 JST). -var_dump($timeOffset); -?> -]]> - - + &info.function.alias; DateTimeZone::getOffset diff --git a/reference/datetime/functions/timezone-transitions-get.xml b/reference/datetime/functions/timezone-transitions-get.xml index 83c412d459..e684ed05a8 100644 --- a/reference/datetime/functions/timezone-transitions-get.xml +++ b/reference/datetime/functions/timezone-transitions-get.xml @@ -1,66 +1,15 @@ - + timezone_transitions_get - Returns all transitions for the timezone + &Alias; DateTimeZone::getTransitions + &reftitle.description; - - arraytimezone_transitions_get - DateTimeZoneobject - - - arrayDateTimeZone::getTransitions - - - - - - &reftitle.parameters; - - &date.datetimezone.description; - - - - - - &reftitle.returnvalues; - - Returns numerically indexed array containing associative array with all - transitions on success or &false; on failure. - - - - - &reftitle.examples; - - - A <function>timezone_transitions_get</function> example - -getTransitions())); -?> -]]> - - &example.outputs.similar; - - -1693706400 - [time] => 1916-04-30T22:00:00+0000 - [offset] => 7200 - [isdst] => 1 - [abbr] => CEST -) -]]> - - + &info.function.alias; DateTimeZone::getTransitions