note 30669 deleted from function.date by vincent
| From: | vincent@php.net | Date: | Fri, 12 Sep 2003 07:23:26 +0000 |
| Subject: | note 30669 deleted from function.date by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56349@lists.php.net to get a copy of this message | ||
Note Submitter: andreas.schmeiler@rtlnewmedia.de
----
Did you ever wonder how to convert a windows timestamp into a unix timestamp? E.g. a timestamp
generated by an ASP-Script, VisualBasic or whatever.
This function works pretty well for me:
function wT2uT($win_timestamp) {
$WIN_DATE_CONST=2209165200;
$WIN_TIME_CONST=115740.74074074;
list($win_date, $win_time)=explode(",",$win_timestamp);
$ux_date = $win_date*24*60*60;
$ux_date-= $WIN_DATE_CONST;
$ux_time = round($win_time/$WIN_TIME_CONST);
return($ux_date+$ux_time);
}
EXAMPLE:
$win_ts="37705,9798611111";
print date("d.m.Y H:i:s", wT2uT($win_ts);
should result into this output:
25.03.2003 23:31
ATTENTION:
Using this function you probably will run into trouble with Summer- and Wintertime. You will have to
convert Summer into Wintertime (and vice versa) manually!