v5:datetime:adodb_date
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
datetime:adodb_date [2015/11/26 15:09] – mnewnham | v5:datetime:adodb_date [2023/05/18 18:55] (current) – Deprecated dregad | ||
---|---|---|---|
Line 5: | Line 5: | ||
[[http:// | [[http:// | ||
== Syntax == | == Syntax == | ||
- | | + | |
+ | string $format, | ||
+ | optional mixed $timestamp = false | ||
+ | | ||
</ | </ | ||
+ | |||
+ | <WRAP important> | ||
+ | [[datetime_index# | ||
+ | Use 64-bit native PHP functions instead. | ||
+ | </ | ||
+ | |||
===== Description ===== | ===== Description ===== | ||
+ | This function converts a timestamp to a formatted local date. If '' | ||
+ | ------------------------------------- | ||
+ | ===== Usage ====== | ||
+ | <code php> | ||
+ | print adodb_date(' | ||
+ | /* | ||
+ | * Prints 03/12/2015 | ||
+ | */ | ||
+ | |||
+ | print adodb_date(' | ||
+ | /* | ||
+ | * Prints 12/31/1969 | ||
+ | */ | ||
+ | |||
+ | print adodb_date(' | ||
+ | /* | ||
+ | * Prints 12/21/1099 | ||
+ | */ | ||
+ | </ | ||
+ | ===== Available Formats ===== | ||
+ | The format fields that adodb_date supports: | ||
+ | |||
+ | a - " | ||
+ | A - " | ||
+ | d - day of the month, 2 digits with leading zeros; i.e. " | ||
+ | D - day of the week, textual, 3 letters; e.g. " | ||
+ | F - month, textual, long; e.g. " | ||
+ | g - hour, 12-hour format without leading zeros; i.e. " | ||
+ | G - hour, 24-hour format without leading zeros; i.e. " | ||
+ | h - hour, 12-hour format; i.e. " | ||
+ | H - hour, 24-hour format; i.e. " | ||
+ | i - minutes; i.e. " | ||
+ | j - day of the month without leading zeros; i.e. " | ||
+ | l - (lowercase ' | ||
+ | L - boolean for whether it is a leap year; i.e. " | ||
+ | m - month; i.e. " | ||
+ | M - month, textual, 3 letters; e.g. " | ||
+ | n - month without leading zeros; i.e. " | ||
+ | O - Difference to Greenwich time in hours; e.g. " | ||
+ | Q - Quarter, as in 1, 2, 3, 4 | ||
+ | r - RFC 2822 formatted date; e.g. "Thu, 21 Dec 2000 16:01:07 +0200" | ||
+ | s - seconds; i.e. " | ||
+ | S - English ordinal suffix for the day of the month, | ||
+ | 2 characters i.e. " | ||
+ | t - number of days in the given month; i.e. " | ||
+ | T - Timezone setting of this machine; e.g. " | ||
+ | U - seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) | ||
+ | w - day of the week, numeric, i.e. " | ||
+ | Y - year, 4 digits; e.g. " | ||
+ | y - year, 2 digits; e.g. " | ||
+ | z - day of the year; i.e. " | ||
+ | Z - timezone offset in seconds (i.e. " | ||
+ | The offset for timezones west of UTC is always negative, | ||
+ | and for those east of UTC is always positive. | ||
+ | |||
+ | The following formats are unsupported: | ||
- | Convert a timestamp to a formatted local date. If $timestamp is not defined, the current timestamp is used. Unlike the function date(), it supports dates outside the 1901 to 2038 range.The format fields that adodb_date supports: | + | |
- | a - " | + | I - (capital i) - " |
- | A - " | + | W - ISO-8601 week number of year, weeks starting on Monday |
- | d - day of the month, 2 digits with leading zeros; i.e. " | + | |
- | D - day of the week, textual, 3 letters; e.g. " | + | |
- | F - month, textual, long; e.g. " | + | |
- | g - hour, 12-hour format without leading zeros; i.e. " | + | |
- | G - hour, 24-hour format without leading zeros; i.e. " | + | |
- | h - hour, 12-hour format; i.e. " | + | |
- | H - hour, 24-hour format; i.e. " | + | |
- | i - minutes; i.e. " | + | |
- | j - day of the month without leading zeros; i.e. " | + | |
- | l (lowercase ' | + | |
- | L - boolean for whether it is a leap year; i.e. " | + | |
- | m - month; i.e. " | + | |
- | M - month, textual, 3 letters; e.g. " | + | |
- | n - month without leading zeros; i.e. " | + | |
- | O - Difference to Greenwich time in hours; e.g. " | + | |
- | Q - Quarter, as in 1, 2, 3, 4 | + | |
- | r - RFC 2822 formatted date; e.g. "Thu, 21 Dec 2000 16:01:07 +0200" | + | |
- | s - seconds; i.e. " | + | |
- | S - English ordinal suffix for the day of the month, 2 characters; | + | |
- | | + | |
- | t - number of days in the given month; i.e. " | + | |
- | T - Timezone setting of this machine; e.g. " | + | |
- | U - seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) | + | |
- | w - day of the week, numeric, i.e. " | + | |
- | Y - year, 4 digits; e.g. " | + | |
- | y - year, 2 digits; e.g. " | + | |
- | z - day of the year; i.e. " | + | |
- | Z - timezone offset in seconds (i.e. " | + | |
- | | + | |
- | and for those east of UTC is always positive. | + | |
- | Unsupported: | + | |
- | B - Swatch Internet time | + | |
- | I (capital i) - " | + | |
- | W - ISO-8601 week number of year, weeks starting on Monday | + |
v5/datetime/adodb_date.1448546991.txt.gz · Last modified: 2017/04/21 11:27 (external edit)