ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:datetime:datetime_index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
datetime:datetime_library [2015/12/02 20:58] – [Table] mnewnhamv5:datetime:datetime_index [2023/05/18 18:49] (current) – Deprecated dregad
Line 1: Line 1:
-====== ADOdb Date/Time Libaray ====== +<WRAP right box
-<WRAP alert+[[v5:datetime:Index]]\\
-  * Support for Daylight Savings Time may not be completely implemented +
-  * There may be conflicting functionality with the [[http://php.net/manual/en/function.date-default-timezone-set.php|PHP Date Default Timezone Functionality]]+
 </WRAP> </WRAP>
 +
 +====== ADOdb Date/Time Library ======
 +<wrap />
 +<WRAP important>
 +[[datetime_index#deprecated|Deprecated]] since ADOdb 5.22.6, and [[https://github.com/ADOdb/ADOdb/issues/970|removed in 5.23.0]].
 +Use 64-bit native PHP functions instead.
 +</WRAP>
 +
 ===== 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's signed integers (normally 32-bits) with PHP floating 
-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's signed integers (normally 32-bits) with PHP floating 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 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(). Since version 5.20.13, the future date cutoff is limited to 200 years by default. This value is controlled by a constant which may be modified for user requirement. 
 + 
 +==== Deprecated ==== 
 + 
 +The [[adodb_strftime|adodb_strftime()]] and [[adodb_gmstrftime|adodb_gmstrftime()]] functions rely on //strftime()// and //gmstrftime()//, which were [[https://www.php.net/manual/en/migration81.deprecated.php#migration81.deprecated.date|deprecated in  
 +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://github.com/ADOdb/ADOdb/issues/963#issuecomment-1553243119|decided not to fix the deprecation warnings]] and discontinue the library instead. 
 + 
 +There is an [[https://php.watch/versions/8.1/strftime-gmstrftime-deprecated|article on PHP.Watch]] which provides suggestions to replace //strftime()// and //gmstrftime()//
  
 ===== Functions Replaced ===== ===== Functions Replaced =====
-This library replaces native functions as follows: 
  
- getdate()  with  adodb_getdate() +This library replaces PHP native functions as follows: 
- date()     with  adodb_date() + 
- gmdate()   with  adodb_gmdate() +^ PHP function ^ ADOdb replacement 
- mktime()   with  adodb_mktime() +getdate()    adodb_getdate()    | 
- gmmktime() with  adodb_gmmktime() +date()       | adodb_date()       | 
- strftime() with  adodb_strftime() +gmdate()     | adodb_gmdate()     | 
- strftime() with  adodb_gmstrftime()+mktime()     | adodb_mktime()     | 
 +gmmktime()   | adodb_gmmktime()   | 
 +strftime()   | adodb_strftime()   | 
 +| gmstrftime(  adodb_gmstrftime() |
  
 The parameters are identical, except that ''adodb_date()'' accepts a subset of ''date()'s'' field formats. Mktime() will convert from local time to GMT, and date() will convert from GMT to local time, but daylight savings is The parameters are identical, except that ''adodb_date()'' accepts a subset of ''date()'s'' field formats. Mktime() will convert from local time to GMT, and date() will convert from GMT to local time, but daylight savings is
 not handled currently. not handled currently.
  
-This library is independant of the rest of ADOdb, and can be used as standalone code.+This library is independent of the rest of ADOdb, and can be used as standalone code. 
 + 
 +<WRAP info> 
 +  * Support for Daylight Savings is not completely implemented ([[#daylight_savings_time|see below]]). 
 +  * There may be conflicting functionality with the [[https://www.php.net/manual/en/function.date-default-timezone-set.php|PHP Date Default Timezone Functionality]] 
 +</WRAP> 
  
 ===== Performance ===== ===== Performance =====
Line 44: Line 69:
 */ */
 </code> </code>
 +===== Daylight Savings Time ===== 
 +ADOdb date/time library does not support daylight savings time but you can write [[v5:datetime:custom_dst|your own function]]. 
 +===== 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 ''ADODB_FUTURE_DATE_CUTOFF_YEARS'' which may be set as needed by the end user.  
 ===== Function Descriptions ====== ===== Function Descriptions ======
-^ Function                                          ^ Description                                                                      +^ Function                                                         ^ Description                                                                                  
-| [[datetime:adodb_time|adodb_time()]]              | Returns the current time measured in the number of seconds since the Unix Epoch  | +| [[v5:datetime:adodb_time|adodb_time()]]                          | Returns the current time measured in the number of seconds since the Unix Epoch as a string  | 
-| [[datetime:adodb_getdate|adodb_getdate()]]        | Returns an array containing date information                                     +| [[v5:datetime:adodb_getdate|adodb_getdate()]]                    | Returns an array containing date information                                                 
-| [[datetime:adodb_date|adodb_date()]]              | Convert a timestamp to a formatted local date                                    +| [[v5:datetime:adodb_date|adodb_date()]]                          | Convert a timestamp to a formatted local date                                                
-| [[datetime:adodb_date2|adodb_date2()]]            | Same as adodb_date, but 2nd parameter accepts iso date                           +| [[v5:datetime:adodb_date2|adodb_date2()]]                        | Same as adodb_date, but 2nd parameter accepts iso date                                       
-| [[datetime:adodb_gmdate|adodb_gmdate()]]          | Convert a timestamp to a formatted GMT date                                      +| [[v5:datetime:adodb_gmdate|adodb_gmdate()]]                      | Convert a timestamp to a formatted GMT date                                                  
-| [[datetime:adodb_mktime|adodb_mktime()]]          | Converts a local date to a unix timestamp                                        +| [[v5:datetime:adodb_mktime|adodb_mktime()]]                      | Converts a local date to a unix timestamp                                                    
-| [[datetime:adodb_gmmktime|adodb_gmmktime()]]      | Converts a gmt date to a unix timestamp                                          +| [[v5:datetime:adodb_gmmktime|adodb_gmmktime()]]                  | Converts a gmt date to a unix timestamp                                                      
-| [[datetime:adodb_gmstrftime|adodb_gmstrftime()]]  | Convert a timestamp to a formatted GMT date                                      +| [[v5:datetime:adodb_gmstrftime|adodb_gmstrftime()]]              | Convert a timestamp to a formatted GMT date                                                  
-| [[datetime:adodb_strftime|adodb_strftime()]]      | Convert a timestamp to a formatted local date                                    |+| [[v5:datetime:adodb_strftime|adodb_strftime()]]                  | Convert a timestamp to a formatted local date                                                | 
 +| [[v5:datetime:adodb_last_date_status|adodb_last_date_status()]]  | Returns the success of the last date conversion                                              |
  
  
v5/datetime/datetime_index.1449086292.txt.gz · Last modified: 2017/04/21 11:26 (external edit)