Difference between revisions of "Stamp2WeekdayStr"
Jump to navigation
Jump to search
Void Singer (talk | contribs) m (added byte costs) |
m (<lsl> tag to <source>) |
||
Line 14: | Line 14: | ||
* MONO: 1024 bytes | * MONO: 1024 bytes | ||
<!-- Please replace with similarly licensed code only --> | <!-- Please replace with similarly licensed code only --> | ||
< | <source lang="lsl2">string uStamp2WeekdayStr( integer vIntYear, integer vIntMonth, integer vIntDay ){ | ||
return llList2String ( ["Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday"], | return llList2String ( ["Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday"], | ||
(vIntYear + (vIntYear >> 2) - ((vIntMonth < 3) & !(vIntYear & 3)) + vIntDay | (vIntYear + (vIntYear >> 2) - ((vIntMonth < 3) & !(vIntYear & 3)) + vIntDay | ||
Line 23: | Line 23: | ||
/*// 2009 (CC0) [ http://creativecommons.org/publicdomain/zero/1.0 ] //*/ | /*// 2009 (CC0) [ http://creativecommons.org/publicdomain/zero/1.0 ] //*/ | ||
/*// Void Singer [ https://wiki.secondlife.com/wiki/User:Void_Singer ] //*/ | /*// Void Singer [ https://wiki.secondlife.com/wiki/User:Void_Singer ] //*/ | ||
/*//-- --//*/</ | /*//-- --//*/</source> | ||
}} | }} | ||
Latest revision as of 14:35, 22 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials | User-Defined Functions | Void's User Page |
User-Defined Function: string uStamp2WeekdayStr( integer vIntYear, integer vIntMonth, integer vIntDay );
Returns a string that is the day of the week for the given date.
- vIntYear: source year
- vIntMonth: source month
- vIntDay: source day
Code:
- LSO: 237 bytes
- MONO: 1024 bytes
string uStamp2WeekdayStr( integer vIntYear, integer vIntMonth, integer vIntDay ){
return llList2String ( ["Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday"],
(vIntYear + (vIntYear >> 2) - ((vIntMonth < 3) & !(vIntYear & 3)) + vIntDay
+ (integer)llGetSubString( "_033614625035", vIntMonth, vIntMonth )) % 7 );
}
/*//-- Anti-License Text --//*/
/*// Contributed Freely to the Public Domain without limitation. //*/
/*// 2009 (CC0) [ http://creativecommons.org/publicdomain/zero/1.0 ] //*/
/*// Void Singer [ https://wiki.secondlife.com/wiki/User:Void_Singer ] //*/
/*//-- --//*/
Caveats
- Accurate from 1901 to 2099