Add license and Authorship details to day of Week
This commit is contained in:
@@ -10,20 +10,18 @@
|
||||
// :DESCRIPTION:
|
||||
// Method to get the day of the week from a unix timestamp - llGetUnixTime. The timestamp returns the number of seconds elapsed beginning Thursday, January 1, 1970 UTC. This script first converts the seconds to hours, then adds the GMT offset (if desired), then converts the hours to days, and finally grabs the day of the week from a list.
|
||||
// :CODE:
|
||||
// Gives day of the week
|
||||
|
||||
// Gives day of the week
|
||||
|
||||
// Copyright © 2016 Linden Research, Inc. Licensed under Creative Commons Attribution-Share Alike 3.0
|
||||
// DoteDote Edison
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
list weekdays = ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"];
|
||||
|
||||
integer offset = -4; // offset from UTC
|
||||
|
||||
|
||||
|
||||
default {
|
||||
|
||||
state_entry() {
|
||||
list weekdays = ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"];
|
||||
|
||||
integer offset = -4; // offset from UTC
|
||||
|
||||
|
||||
|
||||
default {
|
||||
|
||||
|
||||
@@ -1,26 +1,29 @@
|
||||
// :CATEGORY:Clock
|
||||
// :NAME:Get_Day_of_Week
|
||||
// :AUTHOR:DoteDote Edison
|
||||
// :CREATED:2010-01-10 05:20:56.000
|
||||
// :EDITED:2013-09-18 15:38:54
|
||||
// :ID:346
|
||||
// :NUM:469
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// And a function version:
|
||||
// :CODE:
|
||||
string getDay(integer offset) {
|
||||
|
||||
list weekdays = ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"];
|
||||
|
||||
integer hours = llGetUnixTime()/3600;
|
||||
|
||||
integer days = (hours + offset)/24;
|
||||
|
||||
integer day_of_week = days%7;
|
||||
|
||||
return llList2String(weekdays, day_of_week);
|
||||
|
||||
}
|
||||
|
||||
// :CATEGORY:Clock
|
||||
// :NAME:Get_Day_of_Week
|
||||
// :AUTHOR:DoteDote Edison
|
||||
// :CREATED:2010-01-10 05:20:56.000
|
||||
// :EDITED:2013-09-18 15:38:54
|
||||
// :ID:346
|
||||
// :NUM:469
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// And a function version:
|
||||
// :CODE:
|
||||
|
||||
// Copyright © 2016 Linden Research, Inc. Licensed under Creative Commons Attribution-Share Alike 3.0
|
||||
|
||||
string getDay(integer offset) {
|
||||
list weekdays = ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"];
|
||||
integer hours = llGetUnixTime()/3600;
|
||||
integer days = (hours + offset)/24;
|
||||
integer day_of_week = days%7;
|
||||
return llList2String(weekdays, day_of_week);
|
||||
}
|
||||
|
||||
default {
|
||||
touch_start(integer total_number) {
|
||||
integer offset = -4; // offset from UTC
|
||||
llSay(0, "Today is " + getDay(offset) + ".");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user