Fix: Enfin des fonctions de date rapident qui s'affranchissent des limites sur les annees <1970 et >=2038.
This commit is contained in:
parent
052fe5c81b
commit
2cf84b78b2
@ -528,7 +528,12 @@ function dolibarr_print_date($time,$format='')
|
|||||||
$shour = $reg[4];
|
$shour = $reg[4];
|
||||||
$smin = $reg[5];
|
$smin = $reg[5];
|
||||||
|
|
||||||
if ($syear < 1970 && isset($_SERVER["WINDIR"]))
|
$usealternatemethod=false;
|
||||||
|
if ($year <= 1970) $usealternatemethod=true;
|
||||||
|
if ($year >= 2038) $usealternatemethod=true;
|
||||||
|
//if ($year <= 1970 && $_SERVER["WINDIR"]) $usealternatemethod=true;
|
||||||
|
|
||||||
|
if ($usealternatemethod)
|
||||||
{
|
{
|
||||||
return strftime($format,dolibarr_mktime($shour,$smin,0,$smonth,$sday,$syear));
|
return strftime($format,dolibarr_mktime($shour,$smin,0,$smonth,$sday,$syear));
|
||||||
}
|
}
|
||||||
@ -554,7 +559,7 @@ function dolibarr_stringtotime($string)
|
|||||||
{
|
{
|
||||||
$string=eregi_replace('[^0-9]','',$string);
|
$string=eregi_replace('[^0-9]','',$string);
|
||||||
$tmp=$string.'000000'; // Si date YYYYMMDD
|
$tmp=$string.'000000'; // Si date YYYYMMDD
|
||||||
$date=mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4));
|
$date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4));
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,9 +596,9 @@ function dolibarr_stringtotime($string)
|
|||||||
function dolibarr_getdate($timestamp,$fast=false)
|
function dolibarr_getdate($timestamp,$fast=false)
|
||||||
{
|
{
|
||||||
$usealternatemethod=false;
|
$usealternatemethod=false;
|
||||||
if ($year <= 1901) $usealternatemethod=true;
|
if ($year <= 1970) $usealternatemethod=true;
|
||||||
if ($year >= 2038) $usealternatemethod=true;
|
if ($year >= 2038) $usealternatemethod=true;
|
||||||
if ($year <= 1970 && $_SERVER["WINDIR"]) $usealternatemethod=true;
|
//if ($year <= 1970 && $_SERVER["WINDIR"]) $usealternatemethod=true;
|
||||||
|
|
||||||
if ($usealternatemethod)
|
if ($usealternatemethod)
|
||||||
{
|
{
|
||||||
@ -624,9 +629,9 @@ function dolibarr_mktime($hour,$minute,$second,$month,$day,$year)
|
|||||||
//print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -";
|
//print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -";
|
||||||
|
|
||||||
$usealternatemethod=false;
|
$usealternatemethod=false;
|
||||||
if ($year <= 1901) $usealternatemethod=true;
|
if ($year <= 1970) $usealternatemethod=true;
|
||||||
if ($year >= 2038) $usealternatemethod=true;
|
if ($year >= 2038) $usealternatemethod=true;
|
||||||
if ($year <= 1970 && $_SERVER["WINDIR"]) $usealternatemethod=true;
|
//if ($year <= 1970 && $_SERVER["WINDIR"]) $usealternatemethod=true;
|
||||||
|
|
||||||
if ($usealternatemethod)
|
if ($usealternatemethod)
|
||||||
{
|
{
|
||||||
@ -650,7 +655,7 @@ function dolibarr_mktime($hour,$minute,$second,$month,$day,$year)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Returna formated date
|
\brief Returns formated date
|
||||||
\param fmt Format
|
\param fmt Format
|
||||||
\param timestamp Date
|
\param timestamp Date
|
||||||
\return string Formated date
|
\return string Formated date
|
||||||
@ -658,9 +663,9 @@ function dolibarr_mktime($hour,$minute,$second,$month,$day,$year)
|
|||||||
function dolibarr_date($fmt,$timestamp)
|
function dolibarr_date($fmt,$timestamp)
|
||||||
{
|
{
|
||||||
$usealternatemethod=false;
|
$usealternatemethod=false;
|
||||||
if ($year <= 1901) $usealternatemethod=true;
|
if ($year <= 1970) $usealternatemethod=true;
|
||||||
if ($year >= 2038) $usealternatemethod=true;
|
if ($year >= 2038) $usealternatemethod=true;
|
||||||
if ($year <= 1970 && $_SERVER["WINDIR"]) $usealternatemethod=true;
|
//if ($year <= 1970 && $_SERVER["WINDIR"]) $usealternatemethod=true;
|
||||||
|
|
||||||
if ($usealternatemethod)
|
if ($usealternatemethod)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user