ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:datetime:adodb_last_date_status

Differences

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

Link to this comparison view

Next revision
Previous revision
v5:datetime:adodb_last_date_status [2019/01/02 03:31] – created mnewnhamv5:datetime:adodb_last_date_status [2023/05/18 18:53] (current) – Deprecated dregad
Line 5: Line 5:
   bool adodb_last_date_status()   bool adodb_last_date_status()
 </WRAP> </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>
 +
 ===== Description ===== ===== Description =====
 Returns the status of the last time to date conversion constrained by the ''ADODB_FUTURE_DATE_CUTOFF_YEARS'' constant. Returns the status of the last time to date conversion constrained by the ''ADODB_FUTURE_DATE_CUTOFF_YEARS'' constant.
Line 37: Line 43:
     [wday] => 0     [wday] => 0
     [mon] => 11     [mon] => 11
-    [year] => 2218After+    [year] => 2218
     [yday] => 318     [yday] => 318
     [weekday] => Sunday     [weekday] => Sunday
Line 44: Line 50:
 ) )
  
-This is clearly the wrong answer, because the ADODB_FUTURE_DATE_CUTOFF_YEARS has constrained the maximum forward date. Let's check the status +This is clearly the wrong answer, because the ADODB_FUTURE_DATE_CUTOFF_YEARS  
 +has constrained the maximum forward date. Let's check the status 
 */ */
 $status = adodb_last_date_status(); $status = adodb_last_date_status();
  
 /* /*
-* Returns 1 (the function indicates that the last conversion failed+* Returns 1 (the function indicates that the last conversion failed)
 */ */
 +</code>
 +
 +
 +If we modify the constant before including the adodb includes, we can run it again
 +<code php>
 +DEFINE('ADODB_FUTURE_DATE_CUTOFF_YEARS',1000);
 +include 'adodb.inc.php';
 +$s = time() +(60*60*24*365 * 500);
 +/*
 +* Call the function
 +*/
 +$time = adodb_getdate($s);
 +
 +print_r($time);
 +
 +/*
 +Array
 +(
 +    [seconds] => 49
 +    [minutes] => 35
 +    [hours] => 2
 +    [mday] => 3
 +    [wday] => 6
 +    [mon] => 9
 +    [year] => 2518
 +    [yday] => 245
 +    [weekday] => Saturday
 +    [month] => September
 +    [0] => 17314396549
 +)
 +
 +Check the status
 +*/
 +$status = adodb_last_date_status();
 +
 +/*
 +* Returns 0 (the function indicates that the last conversion succeeded)
 +*/
 +
 </code> </code>
  
v5/datetime/adodb_last_date_status.1546396287.txt.gz · Last modified: 2019/01/02 03:31 by mnewnham