Difference between revisions of "User:Vegas Silverweb/How to get the SL Time in Chatlog Format"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with 'There's some pretty terrible LSL implementations out there for getting the 24 hour time as reported by Second Life. There's no reason to use a list or conditionals. This one's Go...')
 
(No difference)

Latest revision as of 20:31, 20 April 2010

There's some pretty terrible LSL implementations out there for getting the 24 hour time as reported by Second Life. There's no reason to use a list or conditionals. This one's Good.

<lsl> string vsGetSLClock() {

   integer time = (integer) llGetWallclock(); 
   integer hours = time / 3600;
   integer minutes = (time / 60) % 60  ;
   return llGetSubString("0"+(string)hours,-2,-1)+":"+
   llGetSubString("0"+(string)minutes,-2,-1);
   }

</lsl>