Difference between revisions of "Stamp2WeekdayStr"

From Second Life Wiki
Jump to navigation Jump to search
m (moved from user page)
 
m (added byte costs)
Line 11: Line 11:


'''Code:'''
'''Code:'''
* LSO: bytes
* LSO: 237 bytes
* MONO: bytes
* MONO: 1024 bytes
<!-- Please replace with similarly licensed code only -->
<!-- Please replace with similarly licensed code only -->
<lsl>string uStamp2WeekdayStr( integer vIntYear, integer vIntMonth, integer vIntDay ){
<lsl>string uStamp2WeekdayStr( integer vIntYear, integer vIntMonth, integer vIntDay ){

Revision as of 16:21, 12 October 2010

Summary

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

<lsl>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 ] //*/

/*//-- --//*/</lsl>

Caveats

  • Accurate from 1901 to 2099