Stamp2WeekdayStr

From Second Life Wiki
Revision as of 15:21, 12 October 2010 by Void Singer (talk | contribs) (added byte costs)
Jump to navigation Jump to search

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