Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Date to Day

Jokey Domela
Registered User
Join date: 27 Jul 2005
Posts: 83
11-20-2005 17:00
Pretty sure this is correct. Feel free to test it out a bit...

This will change a date mm/dd/yy to the day of the week.

CODE
integer dayofweek;
integer m=9; //Jokey Domela's Birthday!
integer d=15;
integer y=6;
integer z;
list days = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];

mathit()
{
if (m < 3)
{
z = y - 1;
}
else
{
z = y;
}
dayofweek = ( llFloor(23 * m/9) + d + 4 + y + llFloor(z/4) - llFloor(z/100) + llFloor(z/400))%7;
if (m >= 3)
{
dayofweek = dayofweek - 2;
}
}

default
{
state_entry()
{
mathit();
string day = llList2String(days, dayofweek);
llSay(0,(string)day);
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
11-20-2005 22:57
/15/a2/72795/1.html
_____________________
i've got nothing. ;)