adodb_last_date_status

Syntax
bool adodb_last_date_status()

Deprecated since ADOdb 5.22.6, and removed in 5.23.0. Use 64-bit native PHP functions instead.

Description

Returns the status of the last time to date conversion constrained by the ADODB_FUTURE_DATE_CUTOFF_YEARS constant.

Summary

The ADODB_FUTURE_DATE_CUTOFF_YEARS sets the farthest date in the future that can be calculated by the following functions:

If the calculated value exceeds the boundary specified by the constant, the request returns the value defined by the current time + the value of the constant in years. In addition, a flag is set that can be read using the adodb_last_date_status() method.

Example

/*
* We attempt to process a datetime 500 years after 2019-01-01 
*/
$s = time() +(60*60*24*365 * 500);
/*
* Call the function
*/
$time = adodb_getdate($s);
 
/*
* Whats the response
 
Array
(
    [seconds] => 11
    [minutes] => 21
    [hours] => 2
    [mday] => 15
    [wday] => 0
    [mon] => 11
    [year] => 2218
    [yday] => 318
    [weekday] => Sunday
    [month] => November
    [0] => 7853595671
)
 
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();
 
/*
* Returns 1 (the function indicates that the last conversion failed)
*/

If we modify the constant before including the adodb includes, we can run it again

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)
*/