From 8c1cd0f8fb7f66785af8fcf0dc221334261a76ef Mon Sep 17 00:00:00 2001 From: Philip Olson Date: Sun, 24 Apr 2005 23:50:58 +0000 Subject: [PATCH] WS, preparation for the new doc style git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@185012 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/datetime/functions/checkdate.xml | 106 +-- reference/datetime/functions/date-sunrise.xml | 164 ++--- reference/datetime/functions/date-sunset.xml | 164 ++--- reference/datetime/functions/date.xml | 633 +++++++++--------- reference/datetime/functions/getdate.xml | 224 ++++--- reference/datetime/functions/gettimeofday.xml | 122 ++-- reference/datetime/functions/gmdate.xml | 100 +-- reference/datetime/functions/gmmktime.xml | 100 +-- reference/datetime/functions/gmstrftime.xml | 62 +- reference/datetime/functions/idate.xml | 262 ++++---- reference/datetime/functions/localtime.xml | 184 +++-- reference/datetime/functions/microtime.xml | 114 ++-- reference/datetime/functions/mktime.xml | 208 +++--- reference/datetime/functions/strftime.xml | 546 ++++++++------- reference/datetime/functions/strtotime.xml | 127 ++-- reference/datetime/functions/time.xml | 62 +- 16 files changed, 1577 insertions(+), 1601 deletions(-) diff --git a/reference/datetime/functions/checkdate.xml b/reference/datetime/functions/checkdate.xml index 93bcd50010..00e11ea56f 100644 --- a/reference/datetime/functions/checkdate.xml +++ b/reference/datetime/functions/checkdate.xml @@ -1,68 +1,68 @@ - + - - - checkdate - Validate a Gregorian date - - - Description - - boolcheckdate - intmonth - intday - intyear - - - Returns &true; if the date given is valid; otherwise returns &false;. - Checks the validity of the date formed by the arguments. A date - is considered valid if: - - - - year is between 1 and 32767 inclusive - - - - - month is between 1 and 12 inclusive - - - - - Day is within the allowed number of - days for the given month. Leap - years are taken into consideration. - - - - - - - <function>checkdate</function> example - + + + checkdate + Validate a Gregorian date + + + Description + + boolcheckdate + intmonth + intday + intyear + + + Returns &true; if the date given is valid; otherwise returns &false;. + Checks the validity of the date formed by the arguments. A date + is considered valid if: + + + + year is between 1 and 32767 inclusive + + + + + month is between 1 and 12 inclusive + + + + + Day is within the allowed number of + days for the given month. Leap + years are taken into consideration. + + + + + + + <function>checkdate</function> example + ]]> - - &example.outputs; - + + &example.outputs; + - - - - - See also mktime and strtotime. - - - + + + + + See also mktime and strtotime. + + + - - - date_sunrise - - Returns time of sunrise for a given day and location - - - - Description - - mixeddate_sunrise - inttimestamp - intformat - floatlatitude - floatlongitude - floatzenith - floatgmt_offset - - - date_sunrise returns the sunrise time for a given - day (specified as a timestamp) and location. The - latitude, longitude and - zenith parameters default to the - date.default_latitude, - date.default_longitude and - date.sunrise_zenith configuration options, - respectively. - - - The latitude defaults to North. So, if you want to - specify a South value, you must pass a negative value. The same note - applies to longitude, which defaults to East. - - - The gmt_offset parameter is specified in hours. - - - <parameter>format</parameter> constants - - - - constant - description - example - - - - - SUNFUNCS_RET_STRING - returns the sunset time as string - 16:46 - - - SUNFUNCS_RET_DOUBLE - returns the result as float - 16.78243132 - - - SUNFUNCS_RET_TIMESTAMP - returns the sunset time as an integer (timestamp) - 1095034606 - - - -
- - - <function>date_sunrise</function> example - + + + + date_sunrise + + Returns time of sunrise for a given day and location + + + + Description + + mixeddate_sunrise + inttimestamp + intformat + floatlatitude + floatlongitude + floatzenith + floatgmt_offset + + + date_sunrise returns the sunrise time for a given + day (specified as a timestamp) and location. The + latitude, longitude and + zenith parameters default to the + date.default_latitude, + date.default_longitude and + date.sunrise_zenith configuration options, + respectively. + + + The latitude defaults to North. So, if you want to + specify a South value, you must pass a negative value. The same note + applies to longitude, which defaults to East. + + + The gmt_offset parameter is specified in hours. + + + <parameter>format</parameter> constants + + + + constant + description + example + + + + + SUNFUNCS_RET_STRING + returns the sunset time as string + 16:46 + + + SUNFUNCS_RET_DOUBLE + returns the result as float + 16.78243132 + + + SUNFUNCS_RET_TIMESTAMP + returns the sunset time as an integer (timestamp) + 1095034606 + + + +
+ + + <function>date_sunrise</function> example + ]]> - - &example.outputs.similar; - +
+ &example.outputs.similar; + - -
-
- - See also date_sunset. - -
-
+]]> + + + + + See also date_sunset. + + + - - - date_sunset - - Returns time of sunset for a given day and location - - - - Description - - mixeddate_sunset - inttimestamp - intformat - floatlatitude - floatlongitude - floatzenith - floatgmt_offset - - - date_sunset returns the sunset time for a given day - (specified as a timestamp) and location. The - latitude, longitude and - zenith parameters default to the - date.default_latitude, - date.default_longitude and - date.sunset_zenith configuration options, - respectively. - - - The latitude defaults to North. So, if you want to - specify a South value, you must pass a negative value. The same note - applies to longitude, which defaults to East. - - - The gmt_offset parameter is specified in hours. - - - <parameter>format</parameter> constants - - - - constant - description - example - - - - - SUNFUNCS_RET_STRING - returns the sunset time as string - 16:46 - - - SUNFUNCS_RET_DOUBLE - returns the result as float - 16.78243132 - - - SUNFUNCS_RET_TIMESTAMP - returns the sunset time as an integer (timestamp) - 1095034606 - - - -
- - - <function>date_sunset</function> example - + + + + date_sunset + + Returns time of sunset for a given day and location + + + + Description + + mixeddate_sunset + inttimestamp + intformat + floatlatitude + floatlongitude + floatzenith + floatgmt_offset + + + date_sunset returns the sunset time for a given day + (specified as a timestamp) and location. The + latitude, longitude and + zenith parameters default to the + date.default_latitude, + date.default_longitude and + date.sunset_zenith configuration options, + respectively. + + + The latitude defaults to North. So, if you want to + specify a South value, you must pass a negative value. The same note + applies to longitude, which defaults to East. + + + The gmt_offset parameter is specified in hours. + + + <parameter>format</parameter> constants + + + + constant + description + example + + + + + SUNFUNCS_RET_STRING + returns the sunset time as string + 16:46 + + + SUNFUNCS_RET_DOUBLE + returns the result as float + 16.78243132 + + + SUNFUNCS_RET_TIMESTAMP + returns the sunset time as an integer (timestamp) + 1095034606 + + + +
+ + + <function>date_sunset</function> example + ]]> - - &example.outputs.similar; - +
+ &example.outputs.similar; + - -
-
- - See also date_sunrise. - -
-
+]]> + + + + + See also date_sunrise. + + + + - - - date - Format a local time/date - - - Description - - stringdate - stringformat - int - timestamp - - + + + date + Format a local time/date + + + Description + + stringdate + stringformat + inttimestamp + + + Returns a string formatted according to the given format string using the + given integer timestamp or the current local time + if no timestamp is given. In other words, timestamp + is optional and defaults to the value of time. + - Returns a string formatted according to the given format string using the - given integer timestamp or the current local time - if no timestamp is given. In other words, timestamp - is optional and defaults to the value of time. - - - The valid range of a timestamp is typically from Fri, 13 Dec - 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are - the dates that correspond to the minimum and maximum values for - a 32-bit signed integer). On Windows this range is limited from - 01-01-1970 to 19-01-2038. - - - - - To generate a timestamp from a string representation of the date, you - may be able to use strtotime. Additionally, some - databases have functions to convert their date formats into timestamps - (such as MySQL's UNIX_TIMESTAMP - function). - - + The valid range of a timestamp is typically from Fri, 13 Dec + 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are + the dates that correspond to the minimum and maximum values for + a 32-bit signed integer). On Windows this range is limited from + 01-01-1970 to 19-01-2038. + + - - The following characters are recognized in the - <parameter>format</parameter> parameter string - - - - format character - Description - Example returned values - - - - - Day - --- - --- - - - 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 - - - S - English ordinal suffix for the day of the month, 2 characters - - st, nd, rd or - th. Works well with j - - - - w - Numeric representation of the day of the week - 0 (for Sunday) through 6 (for Saturday) - - - z - The day of the year (starting from 0) - 0 through 365 - - - Week - --- - --- - - - W - ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0) - Example: 42 (the 42nd week in the year) - - - Month - --- - --- - - - 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 - - - t - Number of days in the given month - 28 through 31 - - - Year - --- - --- - - - L - Whether it's a leap year - 1 if it is a leap year, 0 otherwise. - - - 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 - - - Time - --- - --- - - - a - Lowercase Ante meridiem and Post meridiem - am or pm - - - A - Uppercase Ante meridiem and Post meridiem - AM or PM - - - B - Swatch Internet time - 000 through 999 - - - 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 - - - Timezone - --- - --- - - - I (capital i) - Whether or not the date is in daylights savings time - 1 if Daylight Savings Time, 0 otherwise. - - - O - Difference to Greenwich time (GMT) in hours - Example: +0200 - - - T - Timezone setting of this machine - Examples: EST, MDT ... - - - Z - Timezone offset in seconds. The offset for timezones west of UTC is always - negative, and for those east of UTC is always positive. - -43200 through 43200 - - - Full Date/Time - --- - --- - - - c - ISO 8601 date (added in PHP 5) - 2004-02-12T15:19:21+00:00 - - - r - RFC 2822 formatted date - Example: Thu, 21 Dec 2000 16:01:07 +0200 - - - U - Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) - See also time - - - -
+ To generate a timestamp from a string representation of the date, you + may be able to use strtotime. Additionally, some + databases have functions to convert their date formats into timestamps + (such as MySQL's UNIX_TIMESTAMP + function).
- - Unrecognized characters in the format string will be printed - as-is. The Z format will always return - 0 when using gmdate. - - - - <function>date</function> examples - +
+
+ + + The following characters are recognized in the + <parameter>format</parameter> parameter string + + + + format character + Description + Example returned values + + + + + Day + --- + --- + + + 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 + + + S + English ordinal suffix for the day of the month, 2 characters + + st, nd, rd or + th. Works well with j + + + + w + Numeric representation of the day of the week + 0 (for Sunday) through 6 (for Saturday) + + + z + The day of the year (starting from 0) + 0 through 365 + + + Week + --- + --- + + + W + ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0) + Example: 42 (the 42nd week in the year) + + + Month + --- + --- + + + 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 + + + t + Number of days in the given month + 28 through 31 + + + Year + --- + --- + + + L + Whether it's a leap year + 1 if it is a leap year, 0 otherwise. + + + 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 + + + Time + --- + --- + + + a + Lowercase Ante meridiem and Post meridiem + am or pm + + + A + Uppercase Ante meridiem and Post meridiem + AM or PM + + + B + Swatch Internet time + 000 through 999 + + + 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 + + + Timezone + --- + --- + + + I (capital i) + Whether or not the date is in daylights savings time + 1 if Daylight Savings Time, 0 otherwise. + + + O + Difference to Greenwich time (GMT) in hours + Example: +0200 + + + T + Timezone setting of this machine + Examples: EST, MDT ... + + + Z + Timezone offset in seconds. The offset for timezones west of UTC is always + negative, and for those east of UTC is always positive. + -43200 through 43200 + + + Full Date/Time + --- + --- + + + c + ISO 8601 date (added in PHP 5) + 2004-02-12T15:19:21+00:00 + + + r + RFC 2822 formatted date + Example: Thu, 21 Dec 2000 16:01:07 +0200 + + + U + Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) + See also time + + + +
+
+ + Unrecognized characters in the format string will be printed + as-is. The Z format will always return + 0 when using gmdate. + + + + <function>date</function> examples + ]]> - - - - - You can prevent a recognized character in the format string from being - expanded by escaping it with a preceding backslash. If the character with - a backslash is already a special sequence, you may need to also escape - the backslash. - - Escaping characters in <function>date</function> - + + + + + You can prevent a recognized character in the format string from being + expanded by escaping it with a preceding backslash. If the character with + a backslash is already a special sequence, you may need to also escape + the backslash. + + Escaping characters in <function>date</function> + ]]> - - - - - It is possible to use date and - mktime together to find dates in the future - or the past. - - - <function>date</function> and <function>mktime</function> - example - - + + + + + It is possible to use date and + mktime together to find dates in the future + or the past. + + <function>date</function> and <function>mktime</function>example + ]]> - - - - - This can be more reliable than simply adding or subtracting the number - of seconds in a day or month to a timestamp because of daylight savings - time. - - - + + + - Some examples of date formatting. Note that - you should escape any other characters, as any which currently - have a special meaning will produce undesirable results, and - other characters may be assigned meaning in future PHP versions. - When escaping, be sure to use single quotes to prevent characters - like \n from becoming newlines. - - - <function>date</function> Formatting - - + This can be more reliable than simply adding or subtracting the number + of seconds in a day or month to a timestamp because of daylight savings + time. + + + + + Some examples of date formatting. Note that + you should escape any other characters, as any which currently + have a special meaning will produce undesirable results, and + other characters may be assigned meaning in future PHP versions. + When escaping, be sure to use single quotes to prevent characters + like \n from becoming newlines. + + <function>date</function> Formatting + ]]> - - - - - To format dates in other languages, you should use the - setlocale and strftime - functions. - - - See also getlastmod, gmdate, - mktime, strftime - and time. - -
-
+ + + + + To format dates in other languages, you should use the + setlocale and strftime + functions. + + + See also getlastmod, gmdate, + mktime, strftime + and time. + +
+
+ - - - getdate - Get date/time information - - - Description - - arraygetdate - inttimestamp - - - Returns an associative array containing the date - information of the timestamp, or the current - local time if no timestamp is given, as the - following associative array elements: - - - - Key elements of the returned associative array - - - - Key - Description - Example returned values - - - - - "seconds" - Numeric representation of seconds - 0 to 59 - - - "minutes" - Numeric representation of minutes - 0 to 59 - - - "hours" - Numeric representation of hours - 0 to 23 - - - "mday" - Numeric representation of the day of the month - 1 to 31 - - - "wday" - Numeric representation of the day of the week - 0 (for Sunday) through 6 (for Saturday) - - - "mon" - Numeric representation of a month - 1 through 12 - - - "year" - A full numeric representation of a year, 4 digits - Examples: 1999 or 2003 - - - "yday" - Numeric representation of the day of the year - 0 through 365 - - - "weekday" - A full textual representation of the day of the week - Sunday through Saturday - - - "month" - A full textual representation of a month, such as January or March - January through December - - - 0 - Seconds since the Unix Epoch, similar to the values returned by - time and used by date. - System Dependent, typically -2147483648 through - 2147483647. - - - -
-
- - - - <function>getdate</function> example - - + + + getdate + Get date/time information + + + Description + + arraygetdate + inttimestamp + + + Returns an associative array containing the date + information of the timestamp, or the current + local time if no timestamp is given, as the + following associative array elements: + + + + Key elements of the returned associative array + + + + Key + Description + Example returned values + + + + + "seconds" + Numeric representation of seconds + 0 to 59 + + + "minutes" + Numeric representation of minutes + 0 to 59 + + + "hours" + Numeric representation of hours + 0 to 23 + + + "mday" + Numeric representation of the day of the month + 1 to 31 + + + "wday" + Numeric representation of the day of the week + 0 (for Sunday) through 6 (for Saturday) + + + "mon" + Numeric representation of a month + 1 through 12 + + + "year" + A full numeric representation of a year, 4 digits + Examples: 1999 or 2003 + + + "yday" + Numeric representation of the day of the year + 0 through 365 + + + "weekday" + A full textual representation of the day of the week + Sunday through Saturday + + + "month" + A full textual representation of a month, such as January or March + January through December + + + 0 + + Seconds since the Unix Epoch, similar to the values returned by + time and used by date. + + + System Dependent, typically -2147483648 through + 2147483647. + + + + +
+
+ + + <function>getdate</function> example + ]]> - - &example.outputs.similar; - +
+ &example.outputs.similar; + 1055901520 ) ]]> - -
-
- - See also date, - time, and - setlocale. - -
-
+ + + + + See also date, + time, and + setlocale. + + + + - - - gettimeofday - Get current time - - - Description - - mixedgettimeofday - boolreturn_float - - - This is an interface to gettimeofday(2). It returns an - associative array containing the data returned from the system - call. - - - Since PHP 5.1.0 there is an optional parameter, - return_float, which makes - gettimeofday return a float when it is set to - &true;. - - - Array keys: - - - - "sec" - seconds since the Unix Epoch - - - - - "usec" - microseconds - - - - - "minuteswest" - minutes west of Greenwich - - - - - "dsttime" - type of dst correction - - - - - - - - <function>gettimeofday</function> example - - + + + gettimeofday + Get current time + + + Description + + mixedgettimeofday + boolreturn_float + + + This is an interface to gettimeofday(2). It returns an + associative array containing the data returned from the system + call. + + + Since PHP 5.1.0 there is an optional parameter, + return_float, which makes + gettimeofday return a float when it is set to + &true;. + + + Array keys: + + + + "sec" - seconds since the Unix Epoch + + + + + "usec" - microseconds + + + + + "minuteswest" - minutes west of Greenwich + + + + + "dsttime" - type of dst correction + + + + + + + <function>gettimeofday</function> example + ]]> - - &example.outputs.similar; - + + &example.outputs.similar; + - - - - - + + + + + + - - - gmdate - Format a GMT/UTC date/time - - - Description - - stringgmdate - stringformat - inttimestamp - - - Identical to the date function except that - the time returned is Greenwich Mean Time (GMT). For example, when - run in Finland (GMT +0200), the first line below prints "Jan 01 - 1998 00:00:00", while the second prints "Dec 31 1997 22:00:00". - - <function>gmdate</function> example - + + + gmdate + Format a GMT/UTC date/time + + + Description + + stringgmdate + stringformat + inttimestamp + + + Identical to the date function except that + the time returned is Greenwich Mean Time (GMT). For example, when + run in Finland (GMT +0200), the first line below prints "Jan 01 + 1998 00:00:00", while the second prints "Dec 31 1997 22:00:00". + + <function>gmdate</function> example + ]]> - - - - - - In the Microsoft Windows series of Operating Systems the system - libraries implementing this function are broken, so - gmdate does not support negative values - for the timestamp. - For details see bug reports: - #22620, - #22457, - and #14391. - - - This problem does not occur in Unix/Linux Operating Systems, as the - system libraries behave as expected. - - - PHP cannot fix broken system libraries. Contact - your OS vendor for a fix to this and similar problems. - - - - See also date, mktime, - gmmktime and strftime. - - - + + + + + + In the Microsoft Windows series of Operating Systems the system + libraries implementing this function are broken, so + gmdate does not support negative values + for the timestamp. + For details see bug reports: + #22620, + #22457, + and #14391. + + + This problem does not occur in Unix/Linux Operating Systems, as the + system libraries behave as expected. + + + PHP cannot fix broken system libraries. Contact + your OS vendor for a fix to this and similar problems. + + + + See also date, mktime, + gmmktime and strftime. + + + + - - - gmmktime - Get Unix timestamp for a GMT date - - - Description - - intgmmktime - inthour - intminute - intsecond - intmonth - intday - intyear - intis_dst - - - Identical to mktime except the passed - parameters represents a GMT date. - - - Parameters always represent a GMT date so is_dst - doesn't influence the result. - - - Like mktime, arguments may be left out in order - from right to left, with any omitted arguments being set to the - current corresponding GMT value. - - - - - gmmktime internaly uses mktime - so only times valid in derived local time can be used. - - - - <function>gmmktime</function> on Windows boundary - + + + gmmktime + Get Unix timestamp for a GMT date + + + Description + + intgmmktime + inthour + intminute + intsecond + intmonth + intday + intyear + intis_dst + + + Identical to mktime except the passed + parameters represents a GMT date. + + + Parameters always represent a GMT date so is_dst + doesn't influence the result. + + + Like mktime, arguments may be left out in order + from right to left, with any omitted arguments being set to the + current corresponding GMT value. + + + + + gmmktime internaly uses mktime + so only times valid in derived local time can be used. + + + + <function>gmmktime</function> on Windows boundary + ]]> - - - - - See also mktime, - date and time. - - - + + + + + See also mktime, + date and time. + + + + - - - gmstrftime - - Format a GMT/UTC time/date according to locale settings - - - - Description - - stringgmstrftime - stringformat - inttimestamp - - - Behaves the same as strftime except that the - time returned is Greenwich Mean Time (GMT). For example, when run - in Eastern Standard Time (GMT -0500), the first line below prints - "Dec 31 1998 20:00:00", while the second prints "Jan 01 1999 - 01:00:00". - - <function>gmstrftime</function> example - + + + gmstrftime + Format a GMT/UTC time/date according to locale settings + + + Description + + stringgmstrftime + stringformat + inttimestamp + + + Behaves the same as strftime except that the + time returned is Greenwich Mean Time (GMT). For example, when run + in Eastern Standard Time (GMT -0500), the first line below prints + "Dec 31 1998 20:00:00", while the second prints "Jan 01 1999 + 01:00:00". + + <function>gmstrftime</function> example + ]]> - - - - - See also strftime. - - - + + + + + See also strftime. + + + - - - idate - - Format a local time/date as integer - - - - Description - - intidate - stringformat - inttimestamp - - - Returns a number formatted according to the given format string using the - given integer timestamp or the current local time - if no timestamp is given. In other words, timestamp - is optional and defaults to the value of time. - - - Unlike the function date, idate - accepts just one char in the format parameter. - - - - The following characters are recognized in the - <parameter>format</parameter> parameter string - - - - format character - Description - - - - - B - Swatch Beat/Internet Time - - - d - Day of the month - - - h - Hour (12 hour format) - - - H - Hour (24 hour format) - - - i - Minutes - - - I - returns 1 if DST is activated, - 0 otherwise - - - L - returns 1 for leap year, - 0 otherwise - - - m - Month number - - - s - Seconds - - - t - Days in current month - - - U - Seconds since the Unix Epoch - January 1 1970 00:00:00 GMT - - this is the same as time - - - w - Day of the week (0 on Sunday) - - - W - ISO-8601 week number of year, weeks starting on - Monday - - - y - Year (1 or 2 digits - check note below) - - - Y - Year (4 digits) - - - z - Day of the year - - - Z - Timezone offset in seconds - - - -
-
- - - As idate returns always an integer and - as they can't start with a "0", idate may return less - digits then you would expect. See the example below: - - - - - + + + + idate + Format a local time/date as integer + + + Description + + intidate + stringformat + inttimestamp + + + Returns a number formatted according to the given format string using the + given integer timestamp or the current local time + if no timestamp is given. In other words, timestamp + is optional and defaults to the value of time. + + + Unlike the function date, idate + accepts just one char in the format parameter. + + + + The following characters are recognized in the + <parameter>format</parameter> parameter string + + + + format character + Description + + + + + B + Swatch Beat/Internet Time + + + d + Day of the month + + + h + Hour (12 hour format) + + + H + Hour (24 hour format) + + + i + Minutes + + + I + returns 1 if DST is activated, + 0 otherwise + + + L + returns 1 for leap year, + 0 otherwise + + + m + Month number + + + s + Seconds + + + t + Days in current month + + + U + Seconds since the Unix Epoch - January 1 1970 00:00:00 GMT - + this is the same as time + + + w + Day of the week (0 on Sunday) + + + W + ISO-8601 week number of year, weeks starting on + Monday + + + y + Year (1 or 2 digits - check note below) + + + Y + Year (4 digits) + + + z + Day of the year + + + Z + Timezone offset in seconds + + + +
+
+ + + As idate returns always an integer and + as they can't start with a "0", idate may return less + digits then you would expect. See the example below: + + + + + ]]> - - - - - See also date and - time. - -
-
+
+
+
+ + See also date and + time. + +
+
+ - - - localtime - Get the local time - - - Description - - arraylocaltime - int - timestamp - - bool - is_associative - - - - The localtime function returns an array - identical to that of the structure returned by the C function - call. The first argument to localtime is - the timestamp, if this is not given the current time as returned - from time is used. - The second argument to the localtime is the - is_associative, if this is set to 0 or not - supplied than the array is returned as a regular, numerically - indexed array. If the argument is set to 1 then - localtime is an associative array containing - all the different elements of the structure returned by the C - function call to localtime. The names of the different keys of - the associative array are as follows: - - - - "tm_sec" - seconds - - - - - "tm_min" - minutes - - - - - "tm_hour" - hour - - - - - "tm_mday" - day of the month - - - - - "tm_mon" - month of the year, starting with 0 for January - - - - - "tm_year" - Years since 1900 - - - - - "tm_wday" - Day of the week - - - - - "tm_yday" - Day of the year - - - - - "tm_isdst" - Is daylight savings time in effect - - - - - + + + localtime + Get the local time + + + Description + + arraylocaltime + inttimestamp + boolis_associative + + + The localtime function returns an array + identical to that of the structure returned by the C function + call. The first argument to localtime is + the timestamp, if this is not given the current time as returned + from time is used. + The second argument to the localtime is the + is_associative, if this is set to 0 or not + supplied than the array is returned as a regular, numerically + indexed array. If the argument is set to 1 then + localtime is an associative array containing + all the different elements of the structure returned by the C + function call to localtime. The names of the different keys of + the associative array are as follows: + + - Months are from 0 (Jan) to 11 (Dec) and days of the week are from 0 (Sun) to 6 (Sat). + "tm_sec" - seconds - - - - <function>time</function> example - + + + + "tm_min" - minutes + + + + + "tm_hour" - hour + + + + + "tm_mday" - day of the month + + + + + "tm_mon" - month of the year, starting with 0 for January + + + + + "tm_year" - Years since 1900 + + + + + "tm_wday" - Day of the week + + + + + "tm_yday" - Day of the year + + + + + "tm_isdst" - Is daylight savings time in effect + + + + + + + Months are from 0 (Jan) to 11 (Dec) and days of the week are from 0 (Sun) to 6 (Sat). + + + + + <function>time</function> example + ]]> - - &example.outputs.similar; - + + &example.outputs.similar; + 1 ) ]]> - - - - - + + + + + + - - - microtime - - Return current Unix timestamp with microseconds - - - - Description - - mixedmicrotime - boolget_as_float - - - microtime returns the current Unix timestamp with - microseconds. This function is only available on operating systems that - support the gettimeofday() system call. - - - When called without the optional argument, this function returns the string - "msec sec" where sec is the current time measured in the number of - seconds since the Unix Epoch (0:00:00 January 1, 1970 GMT), and - msec is the microseconds part. - Both portions of the string are returned in units of seconds. - - - When get_as_float is given, and evaluates to - &true;, microtime will return a float. - - - - The get_as_float parameter was added as of - PHP 5.0.0. - - - - - Timing script execution with <function>microtime</function> - + + + microtime + Return current Unix timestamp with microseconds + + + Description + + mixedmicrotime + boolget_as_float + + + microtime returns the current Unix timestamp with + microseconds. This function is only available on operating systems that + support the gettimeofday() system call. + + + When called without the optional argument, this function returns the string + "msec sec" where sec is the current time measured in the number of + seconds since the Unix Epoch (0:00:00 January 1, 1970 GMT), and + msec is the microseconds part. + Both portions of the string are returned in units of seconds. + + + When get_as_float is given, and evaluates to + &true;, microtime will return a float. + + + + The get_as_float parameter was added as of + PHP 5.0.0. + + + + + Timing script execution with <function>microtime</function> + ]]> - - - - Timing script execution in PHP 5 - + + + + Timing script execution in PHP 5 + ]]> - - - - - See also time. - - - + + + + + See also time. + + + + - - - mktime - Get Unix timestamp for a date - - - Description - - intmktime - inthour - intminute - intsecond - intmonth - intday - intyear - intis_dst - - - Warning: Note the strange order of - arguments, which differs from the order of arguments in a regular - Unix mktime() call and which does not lend itself well to leaving - out parameters from right to left (see below). It is a common - error to mix these values up in a script. - - - Returns the Unix timestamp corresponding to the arguments - given. This timestamp is a long integer containing the number of - seconds between the Unix Epoch (January 1 1970 00:00:00 GMT) and the time - specified. - - - Arguments may be left out in order from right to left; any - arguments thus omitted will be set to the current value according - to the local date and time. - - - is_dst can be set to 1 if the time is - during daylight savings time (DST), 0 if it is not, or -1 (the default) - if it is unknown whether the time is within daylight savings time - or not. If it's unknown, PHP tries to figure it out itself. This can - cause unexpected (but not incorrect) results. - - - Some times are invalid if DST is enabled on the system PHP is running on - or is_dst is set to 1. If DST is enabled in e.g. - 2:00, all times between 2:00 and 3:00 are invalid and - mktime returns an undefined (usually negative) value. - Some systems (e.g. Solaris 8) enable DST at midnight so time 0:30 - of the day when DST is enabled is evaluated as 23:30 of the previous day. - - - - is_dst was added in 3.0.10. - - - - mktime is useful for doing date arithmetic - and validation, as it will automatically calculate the correct - value for out-of-range input. For example, each of the following - lines produces the string "Jan-01-1998". - - <function>mktime</function> example - + + + mktime + Get Unix timestamp for a date + + + Description + + intmktime + inthour + intminute + intsecond + intmonth + intday + intyear + intis_dst + + + Warning: Note the strange order of + arguments, which differs from the order of arguments in a regular + Unix mktime() call and which does not lend itself well to leaving + out parameters from right to left (see below). It is a common + error to mix these values up in a script. + + + Returns the Unix timestamp corresponding to the arguments + given. This timestamp is a long integer containing the number of + seconds between the Unix Epoch (January 1 1970 00:00:00 GMT) and the time + specified. + + + Arguments may be left out in order from right to left; any + arguments thus omitted will be set to the current value according + to the local date and time. + + + is_dst can be set to 1 if the time is + during daylight savings time (DST), 0 if it is not, or -1 (the default) + if it is unknown whether the time is within daylight savings time + or not. If it's unknown, PHP tries to figure it out itself. This can + cause unexpected (but not incorrect) results. + + + Some times are invalid if DST is enabled on the system PHP is running on + or is_dst is set to 1. If DST is enabled in e.g. + 2:00, all times between 2:00 and 3:00 are invalid and + mktime returns an undefined (usually negative) value. + Some systems (e.g. Solaris 8) enable DST at midnight so time 0:30 + of the day when DST is enabled is evaluated as 23:30 of the previous day. + + + + is_dst was added in 3.0.10. + + + + mktime is useful for doing date arithmetic + and validation, as it will automatically calculate the correct + value for out-of-range input. For example, each of the following + lines produces the string "Jan-01-1998". + + <function>mktime</function> example + ]]> - - - Year may be a two or four digit value, - with values between 0-69 mapping to 2000-2069 and 70-99 to - 1970-1999 (on systems where time_t is a 32bit signed integer, as - most common today, the valid range for - year is somewhere between 1901 and 2038). - - - - Windows - - Negative timestamps are not supported under any known version - of Windows. Therefore the range of valid years includes only 1970 - through 2038. - - - - - The last day of any given month can be expressed as the "0" day - of the next month, not the -1 day. Both of the following examples - will produce the string "The last day in Feb 2000 is: 29". - - Last day of next month - + + + Year may be a two or four digit value, + with values between 0-69 mapping to 2000-2069 and 70-99 to + 1970-1999 (on systems where time_t is a 32bit signed integer, as + most common today, the valid range for + year is somewhere between 1901 and 2038). + + + + Windows + + Negative timestamps are not supported under any known version + of Windows. Therefore the range of valid years includes only 1970 + through 2038. + + + + + The last day of any given month can be expressed as the "0" day + of the next month, not the -1 day. Both of the following examples + will produce the string "The last day in Feb 2000 is: 29". + + Last day of next month + ]]> - - - - - Date with year, month and day equal to zero is considered illegal - (otherwise it what be regarded as 30.11.1999, which would be strange - behavior). - - - See also gmmktime, - date and time. - - - + + + + + Date with year, month and day equal to zero is considered illegal + (otherwise it what be regarded as 30.11.1999, which would be strange + behavior). + + + See also gmmktime, + date and time. + + + + - - - strftime - - Format a local time/date according to locale settings - - - - Description - - stringstrftime - stringformat - int - timestamp - - + + + strftime + Format a local time/date according to locale settings + + + Description + + stringstrftime + stringformat + inttimestamp + + + Returns a string formatted according to the given format string + using the given timestamp or the current + local time if no timestamp is given. Month and weekday names and + other language dependent strings respect the current locale set + with setlocale. + + + The following conversion specifiers are recognized in the format + string: + + + + %a - abbreviated weekday name according to the current locale + + + + + %A - full weekday name according to the current locale + + + + + %b - abbreviated month name according to the current locale + + + + + %B - full month name according to the current locale + + + + + %c - preferred date and time representation for the current + locale + + + + + %C - century number (the year divided by 100 and truncated to + an integer, range 00 to 99) + + + + + %d - day of the month as a decimal number (range 01 to 31) + + + + + %D - same as %m/%d/%y + + + + + %e - day of the month as a decimal number, a single digit is + preceded by a space (range ' 1' to '31') + + + + + %g - like %G, but without the century. + + + + + %G - The 4-digit year corresponding to the ISO week number (see %V). + This has the same format and value as %Y, except that if the ISO week + number belongs to the previous or next year, that year is used + instead. + + + + + %h - same as %b + + + + + %H - hour as a decimal number using a 24-hour clock (range 00 + to 23) + + + + + %I - hour as a decimal number using a 12-hour clock (range 01 + to 12) + + + + + %j - day of the year as a decimal number (range 001 to 366) + + + + + %m - month as a decimal number (range 01 to 12) + + + + + %M - minute as a decimal number + + + + + %n - newline character + + + + + %p - either `am' or `pm' according to the given time value, or + the corresponding strings for the current locale + + + + + %r - time in a.m. and p.m. notation + + + + + %R - time in 24 hour notation + + + + + %S - second as a decimal number + + + + + %t - tab character + + + + + %T - current time, equal to %H:%M:%S + + + + + %u - weekday as a decimal number [1,7], with 1 representing + Monday + + + + Sun Solaris seems to start with Sunday as 1 + although ISO 9889:1999 (the current C standard) clearly + specifies that it should be Monday. + + + + + + %U - week number of the current year as a decimal number, + starting with the first Sunday as the first day of the first + week + + + + + %V - The ISO 8601:1988 week number of the current year as a + decimal number, range 01 to 53, where week 1 is the first + week that has at least 4 days in the current year, and with + Monday as the first day of the week. (Use %G or %g for the year + component that corresponds to the week number for the specified + timestamp.) + + + + + %W - week number of the current year as a decimal number, + starting with the first Monday as the first day of the first + week + + + + + %w - day of the week as a decimal, Sunday being 0 + + + + + %x - preferred date representation for the current locale + without the time + + + + + %X - preferred time representation for the current locale + without the date + + + + + %y - year as a decimal number without a century (range 00 to + 99) + + + + + %Y - year as a decimal number including the century + + + + + %Z or %z - time zone or name or abbreviation + + + + + %% - a literal `%' character + + + + - Returns a string formatted according to the given format string - using the given timestamp or the current - local time if no timestamp is given. Month and weekday names and - other language dependent strings respect the current locale set - with setlocale. + Not all conversion specifiers may be supported by your C + library, in which case they will not be supported by PHP's + strftime. Additionally, not all platforms + support negative timestamps, therefore your date range may + be limited to no earlier than the Unix epoch. This means that + e.g. %e, %T, %R and %D (there might be more) and dates prior to + Jan 1, 1970 will not work on Windows, some Linux + distributions, and a few other operating systems. For Windows systems a + complete overview of supported conversion specifiers can be found at this + MSDN website. - - The following conversion specifiers are recognized in the format - string: - - - - %a - abbreviated weekday name according to the current locale - - - - - %A - full weekday name according to the current locale - - - - - %b - abbreviated month name according to the current locale - - - - - %B - full month name according to the current locale - - - - - %c - preferred date and time representation for the current - locale - - - - - %C - century number (the year divided by 100 and truncated to - an integer, range 00 to 99) - - - - - %d - day of the month as a decimal number (range 01 to 31) - - - - - %D - same as %m/%d/%y - - - - - %e - day of the month as a decimal number, a single digit is - preceded by a space (range ' 1' to '31') - - - - - %g - like %G, but without the century. - - - - - %G - The 4-digit year corresponding to the ISO week number (see %V). - This has the same format and value as %Y, except that if the ISO week - number belongs to the previous or next year, that year is used - instead. - - - - - %h - same as %b - - - - - %H - hour as a decimal number using a 24-hour clock (range 00 - to 23) - - - - - %I - hour as a decimal number using a 12-hour clock (range 01 - to 12) - - - - - %j - day of the year as a decimal number (range 001 to 366) - - - - - %m - month as a decimal number (range 01 to 12) - - - - - %M - minute as a decimal number - - - - - %n - newline character - - - - - %p - either `am' or `pm' according to the given time value, or - the corresponding strings for the current locale - - - - - %r - time in a.m. and p.m. notation - - - - - %R - time in 24 hour notation - - - - - %S - second as a decimal number - - - - - %t - tab character - - - - - %T - current time, equal to %H:%M:%S - - - - - %u - weekday as a decimal number [1,7], with 1 representing - Monday - - - - Sun Solaris seems to start with Sunday as 1 - although ISO 9889:1999 (the current C standard) clearly - specifies that it should be Monday. - - - - - - %U - week number of the current year as a decimal number, - starting with the first Sunday as the first day of the first - week - - - - - %V - The ISO 8601:1988 week number of the current year as a - decimal number, range 01 to 53, where week 1 is the first - week that has at least 4 days in the current year, and with - Monday as the first day of the week. (Use %G or %g for the year - component that corresponds to the week number for the specified - timestamp.) - - - - - %W - week number of the current year as a decimal number, - starting with the first Monday as the first day of the first - week - - - - - %w - day of the week as a decimal, Sunday being 0 - - - - - %x - preferred date representation for the current locale - without the time - - - - - %X - preferred time representation for the current locale - without the date - - - - - %y - year as a decimal number without a century (range 00 to - 99) - - - - - %Y - year as a decimal number including the century - - - - - %Z or %z - time zone or name or abbreviation - - - - - %% - a literal `%' character - - - - - - Not all conversion specifiers may be supported by your C - library, in which case they will not be supported by PHP's - strftime. Additionally, not all platforms - support negative timestamps, therefore your date range may - be limited to no earlier than the Unix epoch. This means that - e.g. %e, %T, %R and %D (there might be more) and dates prior to - Jan 1, 1970 will not work on Windows, some Linux - distributions, and a few other operating systems. For Windows systems a - complete overview of supported conversion specifiers can be found at this - MSDN website. - - - - <function>strftime</function> locale examples - + + + <function>strftime</function> locale examples + ]]> - - - This example works if you have the respective locales installed - in your system. - - - %G and %V, which are based on ISO 8601:1988 week numbers can - give unexpected (albeit correct) results if the numbering system - is not thoroughly understood. See %V above and example below. - - - - ISO 8601:1988 week number example - + + + This example works if you have the respective locales installed + in your system. + + + %G and %V, which are based on ISO 8601:1988 week numbers can + give unexpected (albeit correct) results if the numbering system + is not thoroughly understood. See %V above and example below. + + + + ISO 8601:1988 week number example + ]]> - - - - - See also setlocale, - mktime, - strptime, - and the - Open Group specification of strftime. - - - + + + + + See also setlocale, + mktime, + strptime, + and the + Open Group specification of strftime. + + + + - - - strtotime - - Parse about any English textual datetime description into a Unix - timestamp - - - - Description - - intstrtotime - stringtime - intnow - - - The function expects to be given a string containing an English date - format and will try to parse that format into a Unix timestamp (the - number of seconds since January 1 1970 00:00:00 GMT), relative - to the timestamp given in now, or the current time - if none is supplied. Upon failure, -1 is returned. - - - Because strtotime behaves according to GNU - date syntax, have a look at the GNU manual page titled - Date Input Formats. - Described there is valid syntax for the time - parameter. - - - - In PHP 5 up to 5.0.2, "now" and other relative times - are wrongly computed from today's midnight. It differs from other - versions where it is correctly computed from current time. - - - - - <function>strtotime</function> examples - + + + strtotime + Parse about any English textual datetime description into a Unix timestamp + + + Description + + intstrtotime + stringtime + intnow + + + The function expects to be given a string containing an English date + format and will try to parse that format into a Unix timestamp (the + number of seconds since January 1 1970 00:00:00 GMT), relative + to the timestamp given in now, or the current time + if none is supplied. Upon failure, -1 is returned. + + + Because strtotime behaves according to GNU + date syntax, have a look at the GNU manual page titled + Date Input Formats. + Described there is valid syntax for the time + parameter. + + + + In PHP 5 up to 5.0.2, "now" and other relative times + are wrongly computed from today's midnight. It differs from other + versions where it is correctly computed from current time. + + + + + <function>strtotime</function> examples + ]]> - - - - - - Checking for failure - + + + + + + Checking for failure + ]]> - - - - - - The valid range of a timestamp is typically from Fri, 13 Dec - 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are - the dates that correspond to the minimum and maximum values for - a 32-bit signed integer.) - Additionally, not all platforms support negative timestamps, therefore - your date range may be limited to no earlier than the Unix epoch. This - means that e.g. dates prior to Jan 1, 1970 will not work on Windows, - some Linux distributions, and a few other operating systems. - - - - + + + + + + The valid range of a timestamp is typically from Fri, 13 Dec + 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are + the dates that correspond to the minimum and maximum values for + a 32-bit signed integer.) + Additionally, not all platforms support negative timestamps, therefore + your date range may be limited to no earlier than the Unix epoch. This + means that e.g. dates prior to Jan 1, 1970 will not work on Windows, + some Linux distributions, and a few other operating systems. + + + + + - - - time - Return current Unix timestamp - - - Description - - inttime - - - - Returns the current time measured in the number of seconds since - the Unix Epoch (January 1 1970 00:00:00 GMT). - - - - <function>time</function> example - + + + time + Return current Unix timestamp + + + Description + + inttime + + + + Returns the current time measured in the number of seconds since + the Unix Epoch (January 1 1970 00:00:00 GMT). + + + + <function>time</function> example + ]]> - - &example.outputs.similar; - + + &example.outputs.similar; + - - - - - See also date and microtime. - - - + + + + + See also date and microtime. + + +