[WebDNA] linux fix for date to day of week
This WebDNA talk-list message is from 2008
It keeps the original formatting.
numero = 101699
interpreted = N
texte = Aloha all, I wrote a function so folks on Linux that need to get the day ofweek from any date (after 1582 or something like that at least) can use thisfunction. Should be easy to modify for your needs. All other platforms, thisfunction is not necessary. The Linux version has a bug with the day of weekin the format days to date function.To use, just call the function and pass in the date you want to check likethis[convertdate thisdate=[date]]Laters, Olin[function name=convertdate] [math]month=[Format Days_To_Date%m][math]{[thisdate]}[/math][/Format][/math] [math]year=[Format Days_To_Date%Y][math]{[thisdate]}[/math][/Format][/math] [math]day=[Format Days_To_Date%d][math]{[thisdate]}[/math][/Format][/math] [showif [month]<3] [math]month=month+12[/math] [math]year=year-1[/math] [/showif] [switch value=[math](day+(2*month)+floor(6*(month +1)/10)+year+floor(year/4)-floor(year/100)+floor(year/400)+1)%7[/math]] [case value=0] [return]Sun[/return] [/case] [case value=1] [return]Mon[/return] [/case] [case value=2] [return]Tue[/return] [/case] [case value=3] [return]Wed[/return] [/case] [case value=4] [return]Thu[/return] [/case] [case value=5] [return]Fri[/return] [/case] [case value=6] [return]Sat[/return] [/case] [/switch] [return][/return][/function]
Associated Messages, from the most recent to the oldest:
|
- [WebDNA] linux fix for date to day of week ("Olin Lagon" 2008)
|
Aloha all, I wrote a function so folks on Linux that need to get the day ofweek from any date (after 1582 or something like that at least) can use thisfunction. Should be easy to modify for your needs. All other platforms, thisfunction is not necessary. The Linux version has a bug with the day of weekin the format days to date function.To use, just call the function and pass in the date you want to check likethis[convertdate thisdate=
[date]]Laters, Olin[function name=convertdate]
[math]month=[Format Days_To_Date%m]
[math]{[thisdate]}[/math][/Format][/math]
[math]year=[Format Days_To_Date%Y]
[math]{[thisdate]}[/math][/Format][/math]
[math]day=[Format Days_To_Date%d]
[math]{[thisdate]}[/math][/Format][/math] [showif [month]<3]
[math]month=month+12[/math]
[math]year=year-1[/math] [/showif] [switch value=
[math](day+(2*month)+floor(6*(month +1)/10)+year+floor(year/4)-floor(year/100)+floor(year/400)+1)%7[/math]] [case value=0]
[return]Sun[/return] [/case] [case value=1]
[return]Mon[/return] [/case] [case value=2]
[return]Tue[/return] [/case] [case value=3]
[return]Wed[/return] [/case] [case value=4]
[return]Thu[/return] [/case] [case value=5]
[return]Fri[/return] [/case] [case value=6]
[return]Sat[/return] [/case] [/switch]
[return][/return][/function]
"Olin Lagon"
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Part Html part WebDNA (1997)
Off Topic: Sound Clips (2003)
installing webcatalog problem. HELP! (1998)
New Site Announcement (1998)
Wrapping text (1998)
different show next (1997)
SSL/Document Contains NO Data (1998)
More on the email templates (1997)
Pirated WebCat? NOT... (2003)
Rename folder under WC3 (2000)
[HIDEIF] inside [FOUNDITEM] (1997)
Not really WebCat- (1997)
Multiple Merchant Accounts? (1997)
Alternating colors (1997)
problem: type 2 errors (1997)
RE: Automatic Forwarding using WebCat (1997)
[WebDNA] Froala Editor working with WebDNA (2016)
Access Denied! But why? (1997)
Webcat 3 Bug?!?! Netscape + Protect + Posted Form (1998)
Database Security Rev., (2002)