note 99610 added to function.time

From: Date: Thu, 26 Aug 2010 13:35:51 +0000
Subject: note 99610 added to function.time
Groups: php.notes 
Request: Send a blank email to php-notes+get-172084@lists.php.net to get a copy of this message
I needed to convert between Unix timestamps and Windows/AD timestamps, so I wrote a pair of simple functions for it. <?php function unix_time_to_win_time($unix_time) { //add the seconds between 1601-01-01 and 1970-01-01 and make it 100-nanosecond precision $win_time = ($unix_time + 11644477200) * 10000000; return $win_time; } function win_time_to_unix_time($win_time) { //round the win timestamp down to seconds and remove the seconds between 1601-01-01 and 1970-01-01 $unix_time = round($win_time / 10000000) - 11644477200; return $unix_time; } ?> ---- Server IP: 80.67.8.162 Probable Submitter: 130.239.57.123 ---- Manual Page -- http://www.php.net/manual/en/function.time.php Edit -- https://master.php.net/note/edit/99610 Del: integrated -- https://master.php.net/note/delete/99610/integrated Del: useless -- https://master.php.net/note/delete/99610/useless Del: bad code -- https://master.php.net/note/delete/99610/bad+code Del: spam -- https://master.php.net/note/delete/99610/spam Del: non-english -- https://master.php.net/note/delete/99610/non-english Del: in docs -- https://master.php.net/note/delete/99610/in+docs Del: other reasons-- https://master.php.net/note/delete/99610 Reject -- https://master.php.net/note/reject/99610 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#172084) next »