[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 of week from any date (after 1582 or something like that at least) can use this function. Should be easy to modify for your needs. All other platforms, this function is not necessary. The Linux version has a bug with the day of week in the format days to date function. To use, just call the function and pass in the date you want to check like this [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:

    
  1. [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 of week from any date (after 1582 or something like that at least) can use this function. Should be easy to modify for your needs. All other platforms, this function is not necessary. The Linux version has a bug with the day of week in the format days to date function. To use, just call the function and pass in the date you want to check like this [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:

[WebDNA] lookup in tables defined in functions - bug? (2016) WebCat2 - Getting to the browser's username/password data (1997) Almost a there but..bye bye NetCloak (1997) Fwd: virtual domain and [listfile] paths and aliases (1998) Way Off Topic (2003) [math] show=F exists? (1997) Smith Micro - no competition (2000) WebCatalog 2.0 & WebDNA docs in HTML ... (1997) Access file on a remote server (2003) WebCat2 several catalogs? (1997) WebCat2b12 CGI Mac - [shownext] problem (1997) Database Security Rev., (2002) Using [Showif] tag. Mac (1997) authenticating a second user (1997) RE: Error: template (1997) Help! WebCat2 bug (1997) delete after x (1998) WebCat2b13MacPlugIn - [shownext method=post] ??? (1997) More Applescript (1997) How much is too much? I can never remember the answer. (2002)