note 39223 modified in function.date by kennyt
| From: | kennyt@php.net | Date: | Sun, 18 Jul 2004 17:26:43 +0000 |
| Subject: | note 39223 modified in function.date by kennyt | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73509@lists.php.net to get a copy of this message | ||
This is a function that converts the integer part of Delphi TDate (days passed from 30/12/1899) to
Unix Timestamp. Hope it can be useful.
<?php
function DelphiDate2UnixTimestamp($delphi_date){
//delphi date is days passed from 30/12/1899
//unix timestamps start from 1/1/1970 = 25569
$UNIX_FIRST_DATE=25569; //1/1/1970 in Delphi
$days=$delphi_date-$UNIX_FIRST_DATE;
if ($days<0){
$days=0;
}
return strtotime("1 January 1970 + $days days");
}
?>
--was--
This is a function that converts the integer part of Delphi TDate (days passed from 30/12/1899) to
Unix Timestamp. Hope it can be useful.
function DelphiDate2UnixTimestamp($delphi_date){
//delphi date is days passed from 30/12/1899
//unix timestamps start from 1/1/1970 = 25569
$UNIX_FIRST_DATE=25569; //1/1/1970 in Delphi
$days=$delphi_date-$UNIX_FIRST_DATE;
if ($days<0){
$days=0;
}
return strtotime("1 January 1970 + $days days");
}
http://php.net/manual/en/function.date.php