/ Published in: ASP
URL: http://reusablecode.blogspot.com/2008/11/swatch-internet-time.html
Convert a time value into a Swatch beat. Requires my str_pad() and floor() functions. To return an accurate result, the time value passed in needs to be UTC/GMT (in other words, without offset). There are two ways to achieve this: set your server's time zone to GMT, or use my UTC time function.
Expand |
Embed | Plain Text
<% ' Copyright (c) 2008, 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 Swatch Internet Time beats for the given time value. ' To be accurate, the input value MUST be Universal Coordinated Time (UTC). ' REQUIRES: str_pad(), floor() function swatch(someTime) swatch = str_pad(floor(((Hour(someTime) * 3600 * 1000) + (Minute(someTime) * 60 * 1000) + (Second(someTime) * 1000)) / 86400), 3, "0", STR_PAD_LEFT) end function %>
You need to login to post a comment.
