note 88498 added to function.time

From: Date: Tue, 27 Jan 2009 01:16:16 +0000
Subject: note 88498 added to function.time
Groups: php.notes 
Request: Send a blank email to php-notes+get-149815@lists.php.net to get a copy of this message
Below, a function to create TNG-style stardates, taking 2009 to start stardate 41000.0. In fact, the offset is trivial to adjust if you wish to begin from a different date. <?php function getStardate(void) { $offset = 2000; $seconds_per_stardate = 31449.6; // is the number of seconds in a year divided by 1000, for hopefully obvious reasons return time() / $seconds_per_stardate + $offset; } ?> Other series use less reliable stardate formats, which makes it difficult [read: nigh impossible] to create a function that converts a unix timestamp into a stardate. ---- Server IP: 87.124.35.190 Probable Submitter: 86.31.36.87 ---- Manual Page -- http://www.php.net/manual/en/function.time.php Edit -- https://master.php.net/note/edit/88498 Del: integrated -- https://master.php.net/note/delete/88498/integrated Del: useless -- https://master.php.net/note/delete/88498/useless Del: bad code -- https://master.php.net/note/delete/88498/bad+code Del: spam -- https://master.php.net/note/delete/88498/spam Del: non-english -- https://master.php.net/note/delete/88498/non-english Del: in docs -- https://master.php.net/note/delete/88498/in+docs Del: other reasons-- https://master.php.net/note/delete/88498 Reject -- https://master.php.net/note/reject/88498 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#149815) next »