Re: Sort of a Dilema!
This WebDNA talk-list message is from 1998
It keeps the original formatting.
numero = 18405
interpreted = N
texte = At 6:54 AM 6/21/98, The Mooseman wrote:>I am in sort of a dilema.>>I have a field name date that has the date written out like: June 1,1998.Well, that's the root your current problem, and many future problems if youdon't change it. The only way to sort such a date is alphbetically as atext string (unless your default date format is %B %d, %Y -- and I'm noteven sure if it would work then); even if you're only sorting dates withinthe same month, you'll get strange results (June 1, June 10, June 11 ....June 2, June 20, etc.). Once you try to sort more that one month, you'llfind that they are sorted alphabetically, (April, August, December,February, January, July, June, March, May, November, October, September)probably not the effect you were looking for.The solution is to store dates either in standard MM/DD/YYYY format (good)or as the number of days since 00/00/0000 (better). Not only will you beable to correctly sort the values (by comparing them either asdatetype=date or datetype=num), but many more complex and highly usefulmath calculations become possible. These formats (especially the number ofdays since 00/00/0000) are also easier for WebCat to parse, so yoursearches will become a little speedier.You can still display the dates to your users in any form that you see fit(i.e. June 3, 1998) by using the [Format Days_to_Date] context.-Daveo--------------- Dave MacLeay --+o----------- Digital Frontier --+o--- dave@digitalfrontier.com --+
Associated Messages, from the most recent to the oldest:
At 6:54 AM 6/21/98, The Mooseman wrote:>I am in sort of a dilema.>>I have a field name date that has the date written out like: June 1,1998.Well, that's the root your current problem, and many future problems if youdon't change it. The only way to sort such a date is alphbetically as atext string (unless your default date format is %B %d, %Y -- and I'm noteven sure if it would work then); even if you're only sorting dates withinthe same month, you'll get strange results (June 1, June 10, June 11 ....June 2, June 20, etc.). Once you try to sort more that one month, you'llfind that they are sorted alphabetically, (April, August, December,February, January, July, June, March, May, November, October, September)probably not the effect you were looking for.The solution is to store dates either in standard MM/DD/YYYY format (good)or as the number of days since 00/00/0000 (better). Not only will you beable to correctly sort the values (by comparing them either asdatetype=date or datetype=num), but many more complex and highly usefulmath calculations become possible. These formats (especially the number ofdays since 00/00/0000) are also easier for WebCat to parse, so yoursearches will become a little speedier.You can still display the dates to your users in any form that you see fit(i.e. June 3, 1998) by using the [Format Days_to_Date] context.-Daveo--------------- Dave MacLeay --+o----------- Digital Frontier --+o--- dave@digitalfrontier.com --+
Dave MacLeay
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:
Bug or syntax error on my part? (1997)
Here we go again...WebDNA - SQL- Clustering (2006)
Redirect me home please? (2000)
writefile and texte (1997)
Associative lookup style? (1997)
[WriteFile] problems (1997)
Fw: Webcat followup question (1999)
WebCatalog can't find database (1997)
WebCatalog 2.0 & WebDNA docs in HTML ... (1997)
Problems with [Applescript] (1997)
Bad File: DeleteCommand.html (1998)
[OT] photos and misc. (2004)
possible, WebCat2.0 and checkboxes-restated (1997)
Text data with spaces in them... (1997)
RequiredFields template (1997)
[WebDNA] Using [PROTECT] (2013)
WebDNA for Dummies (was: WebDNA portability) (2007)
ODBC Help (2004)
Pithy questions on webcommerce & siteedit (1997)
Any user support forums or is the Talklist it? (2007)