/ Published in: ASP
URL: http://reusablecode.blogspot.com/2009/01/stardate.html
Calculate the stardate in the 24th century Star Trek universe for a given Gregorian date in the real universe. Requires my str_pad() function.
Expand |
Embed | Plain Text
<% ' Copyright (c) 2009, reusablecode.blogspot.com; some rights reserved. ' ' This work is licensed under the Creative Commons Attribution License. To view ' a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or ' send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California ' 94305, USA. ' Returns the stardate for a given date. ' Requires str_pad() function stardate(someDateTime) dim season dim episode dim fractime season = cStr(Year(someDateTime) - 1947) episode = str_pad(Round(1000 / 366 * DatePart("y", someDateTime), 0), 3, "0", "left") fractime = left(cStr((Hour(someDateTime) * 60 + Minute(someDateTime)) / 144), 1) stardate = season & episode & "." & fractime end function %>
You need to login to post a comment.
