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:
any suggestions for creating a multi-lingual site? (1999)
Separate SSL Server (1997)
WebCat2 several catalogs? (1997)
more info on [setlineitems] (1997)
Permissions / Restart WebDNA? (2005)
Some Questions (1997)
OT: Anyone on the list from Switzerland? (2003)
Making Thumbnail Graphics (1997)
WebCatalog for guestbook ? (1997)
emailer w/F2 (1997)
Search or delete (or date or time) has bugs ... (1998)
suffix mapping for NT? (1997)
[WebDNA] CORRECTION: 60% failure rate using replace in a loop (2010)
Upgrading old WebCat Database Files (1997)
Read and weep (2003)
PSC recommends what date format yr 2000??? (1997)
Applescript, WebDNA, and PDF (1997)
F2 to F3 rocky transition (1997)
New Plug-in and Type 11 errors (1997)
RE: Server Traffic Simulation (1998)