Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How would i go about returning the SL time in a 24 hour way?

Ginge Reymont
Registered User
Join date: 10 Oct 2005
Posts: 190
12-20-2005 13:09
I would like to get the in game time in 24 hour form e.g 1800 - Military time.

Ive tried with the wikis but no use, can anyone suggest a way? all i need is the hour.
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
12-20-2005 16:41
http://secondlife.com/badgeo/wakka.php?wakka=llGetWallclock

Contains a code snippet that should do it for you - the hours =time/3600 bit should return a number from 0 to 23.

You'll have to string it and bump 0-9 up to 00 - 09 to get 4 digit time.
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
12-21-2005 10:35
Here's a REALLY simple clock script I have...and it's basically just from the WIKI:

CODE

//---------------------------BASIC CLOCK-------------------------------------
//
// By: Kenn Nilsson
// Updated: 12/14/05
// Version: 1.0
//
//---------------------------------------------------------------------------


integer hours;
integer minutes;
integer seconds;
integer currenttime;



default
{
state_entry()
{

}
touch_start(integer number)
{
currenttime = (integer)llGetWallclock();
hours = currenttime / 3600;
minutes = (currenttime % 3600) / 60;
seconds = currenttime % 60;

llInstantMessage(llDetectedKey(0), "The current time is: " + (string)hours + ":" + (string)minutes + ":" + (string)seconds);
}
}


_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Lisa Trudeau
Registered User
Join date: 22 Aug 2005
Posts: 29
12-21-2005 20:25
Here's a link to the WIKI with a clock that has a military time toggle

http://secondlife.com/badgeo/wakka.php?wakka=llGetGMTclock