Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

GetPSTDate() date conversion function

Elle Pollack
Takes internets seriously
Join date: 12 Oct 2004
Posts: 796
12-19-2004 20:21
Converts the UTC date returned by llGetDate() into PST. Enjoy!

CODE

GetPSTDate()
{
//Convert the date from UTC to PST if GMT time is less than 8 hours after midnight
string DateUTC = llGetDate();
if (llGetGMTclock() < 28800)
{
list DateList = llParseString2List(DateUTC, ["-", "-"], []);
integer year = llList2Integer(DateList, 0);
integer month = llList2Integer(DateList, 1);
integer day = llList2Integer(DateList, 2);
day = day - 1;
DateToday = (string)year + "-" + (string)month + "-" + (string)day;
}
else
{
DateToday = llGetDate();
}
}
Parsalin Gullwing
The big PG
Join date: 16 Aug 2004
Posts: 32
no Offense intended
12-28-2004 02:24
Well, i dont mean to offend ya but when i drop that in an object it didnt save right i played with it awhile and came up with this heh i even added a touch and set text effect for looks lol but they can be removed well here it is

CODE

//Parsalin Gullwing was here!
string DateToday;
default
{
state_entry()
{
llSetTimerEvent(43200);
//Convert the date from UTC to PST if GMT time is less than 8 hours after midnight
string DateUTC = llGetDate();
if (llGetGMTclock() < 28800)
{
list DateList = llParseString2List(DateUTC, ["-", "-"], []);
integer year = llList2Integer(DateList, 0);
integer month = llList2Integer(DateList, 1);
integer day = llList2Integer(DateList, 2);
day = day - 1;
DateToday = (string)month + "-" + (string)day + "-" + (string)year;
llSetText((string)DateToday,<100,100,100>,3.0);
}
else
{
DateToday = llGetDate();
llSetText((string)DateToday,<100,100,100>,3.0);
}
}
timer()
{
llSetText((string)DateToday,<100,100,100>,3.0);
}

touch_start(integer total_number)
{
llSay(0, "Todays date is "+(string)DateToday);
}
}