v5:datetime:datetime_index
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
datetime:datetime_library [2015/11/26 15:20] – mnewnham | v5:datetime:datetime_index [2023/05/18 18:49] (current) – Deprecated dregad | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== ADOdb Date/Time Libaray ====== | + | < |
- | < | + | [[v5:datetime:Index]]\\ |
- | * Support for Daylight Savings Time may not be completely implemented | + | |
- | * There may be conflicting functionality with the [[http:// | + | |
</ | </ | ||
+ | |||
+ | ====== ADOdb Date/Time Library ====== | ||
+ | <wrap /> | ||
+ | <WRAP important> | ||
+ | [[datetime_index# | ||
+ | Use 64-bit native PHP functions instead. | ||
+ | </ | ||
+ | |||
===== Introduction ===== | ===== Introduction ===== | ||
- | PHP native date functions use integer timestamps for computations. Because of this, dates are restricted to the years 1901-2038 on Unix and 1970-2038 on Windows due to integer overflow for dates beyond those years. This library overcomes these limitations by replacing the native function' | ||
- | point numbers (normally 64-bits). | ||
- | Dates from 100 A.D. to 3000 A.D. and later have been tested. The minimum is 100 A.D. as <100 will invoke the | + | PHP native date functions use integer timestamps for computations. Because of this, on 32-bit systems dates are restricted to the years 1901-2038 on Unix and 1970-2038 on Windows due to integer overflow for dates beyond those years. |
- | 2 => 4 digit year conversion. The maximum is billions of years in the future, but this is a theoretical limit as the computation of that year would take too long with the current implementation of adodb_mktime(). | + | |
+ | This library overcomes these limitations by replacing the native function' | ||
+ | |||
+ | Dates from 100 A.D. to 3000 A.D. and later have been tested. The minimum is 100 A.D. as <100 will invoke the 2 => 4 digit year conversion. The maximum is billions of years in the future, but this is a theoretical limit as the computation of that year would take too long with the current implementation of adodb_mktime(). | ||
+ | |||
+ | ==== Deprecated ==== | ||
+ | |||
+ | The [[adodb_strftime|adodb_strftime()]] and [[adodb_gmstrftime|adodb_gmstrftime()]] functions rely on // | ||
+ | PHP 8.1]]. | ||
+ | |||
+ | Considering the code's obsolescence in the age of 64-bit computing which allows integer timestamps 292 billion years in the future as well as the complexity of replacing the deprecated functions, it was [[https:// | ||
+ | |||
+ | There is an [[https:// | ||
===== Functions Replaced ===== | ===== Functions Replaced ===== | ||
- | This library replaces native functions as follows: | ||
- | getdate() | + | This library replaces PHP native functions as follows: |
- | date() | + | |
- | gmdate() | + | ^ PHP function ^ ADOdb replacement |
- | mktime() | + | | getdate() |
- | gmmktime() | + | | date() |
- | strftime() | + | | gmdate() |
- | strftime() with | + | | mktime() |
+ | | gmmktime() | ||
+ | | strftime() | ||
+ | | gmstrftime( | ||
The parameters are identical, except that '' | The parameters are identical, except that '' | ||
not handled currently. | not handled currently. | ||
- | This library is independant | + | This library is independent |
+ | |||
+ | <WRAP info> | ||
+ | * Support for Daylight Savings is not completely implemented ([[# | ||
+ | * There may be conflicting functionality with the [[https:// | ||
+ | </ | ||
===== Performance ===== | ===== Performance ===== | ||
Line 44: | Line 69: | ||
*/ | */ | ||
</ | </ | ||
+ | ===== Daylight Savings Time ===== | ||
+ | ADOdb date/time library does not support daylight savings time but you can write [[v5: | ||
+ | ===== Future Date Cutoff ===== | ||
+ | For security reasons, the maximum future date that can be generated is defaulted to 200 years in the future. This is controlled by the constant '' | ||
===== Function Descriptions ====== | ===== Function Descriptions ====== | ||
- | ^Function^Description^ | + | ^ Function |
- | |[[datetime: | + | | [[v5:datetime: |
- | |[[datetime: | + | | [[v5:datetime: |
- | |[[datetime: | + | | [[v5:datetime: |
- | |[[datetime: | + | | [[v5:datetime: |
- | |[[datetime: | + | | [[v5:datetime: |
- | |[[datetime: | + | | [[v5:datetime:adodb_mktime|adodb_mktime()]] |
- | |[[datetime: | + | | [[v5:datetime: |
- | |[[datetime: | + | | [[v5:datetime: |
- | |[[datetime: | + | | [[v5:datetime: |
- | %a - abbreviated weekday name according to the current locale | + | | [[v5:datetime:adodb_last_date_status|adodb_last_date_status()]] | Returns |
- | %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 | + | |
- | %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 ' | + | |
- | %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) | + | |
- | %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 | + | |
- | %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 | + | |
- | %Y - year as a decimal number including the century | + | |
- | %Z - time zone or name or abbreviation | + | |
- | %% - a literal `%' character | + | |
- | Unsupported codes: | + | |
- | %C - century number (the year divided by 100 and truncated to an integer, range 00 to 99) | + | |
- | %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. | + | |
- | %j - day of the year as a decimal number (range 001 to 366) | + | |
- | %u - weekday as a decimal number [1,7], with 1 representing 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 - day of the week as a decimal, Sunday being 0 | + | |
- | %W - week number of the current year as a decimal number, starting with the | + | |
- | first Monday as the first day of the first week | + | |
- | | | + | |
- | ============================================================================= | ||
===== Notes ===== | ===== Notes ===== | ||
Useful url for generating [[http:// | Useful url for generating [[http:// |
v5/datetime/datetime_index.txt · Last modified: 2023/05/18 18:49 by dregad