Difference between revisions of "Unix2WeekdayStr"
Jump to navigation
Jump to search
Void Singer (talk | contribs) m (typos + byte cost) |
m (<lsl> tag to <source>) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 12: | Line 12: | ||
* MONO: 512 bytes | * MONO: 512 bytes | ||
<!-- Please replace with similarly licensed code only --> | <!-- Please replace with similarly licensed code only --> | ||
< | <source lang="lsl2">string uUnix2WeekdayStr( integer vIntDate ){ | ||
return llList2String( ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"], | return llList2String( ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"], | ||
vIntDate % 604800 / 86400 + (vIntDate >> 31) ); | vIntDate % 604800 / 86400 + (vIntDate >> 31) ); | ||
Line 20: | Line 20: | ||
/*// 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> | ||
}} | |||
{{void-box | |||
|title=Notes | |||
|content= | |||
Although the [[llGetUnixTime]] function gets GMT timestamps the return value timestamps can be treated as local time for the purposes of this function, if they are not being made relative to the GMT timezone. If you need a the day to be relative to GMT please add or subtract the current GMT offset for that timezone (EX: SLT == PDT/PST, so the offset is -7hrs/-8hrs or -25200/28,800) | |||
}} | }} | ||
Latest revision as of 15:46, 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 uUnix2WeekdayStr( integer vIntDate );
Returns a string that is the day of the week for the given date.
- vIntDate: source Unix time stamp
Code:
- LSO: 155 bytes
- MONO: 512 bytes
string uUnix2WeekdayStr( integer vIntDate ){
return llList2String( ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"],
vIntDate % 604800 / 86400 + (vIntDate >> 31) );
}
/*//-- 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 ] //*/
/*//-- --//*/
Notes
Although the llGetUnixTime function gets GMT timestamps the return value timestamps can be treated as local time for the purposes of this function, if they are not being made relative to the GMT timezone. If you need a the day to be relative to GMT please add or subtract the current GMT offset for that timezone (EX: SLT == PDT/PST, so the offset is -7hrs/-8hrs or -25200/28,800)