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:
Crazy dates (was: sorting dates) (1999)
[Reload mydata.db] (1998)
taxTotal, too (1997)
WebCat2final1 crashes (1997)
[OT] Mime Headers / Meta-Tags (2003)
Version f1 status (1997)
RE: IIS4b2 and WebCatalog b19 (1997)
Affiliate Marketing Question #2 (1998)
Replacing a price with text (1998)
[WebDNA] WebDNA Code and HTML WYSIWYG Editors (2011)
Modifying order output (1997)
E-mail formating question (1999)
RE: 2nd WebCatalog2 Feature Request (1996)
using showpage and showcart commands (1996)
Using the sendmail command on CGate Pro (Unix) (2000)
sort problems....bug or brain fart? (1997)
Execute Applescript (1997)
Re:2nd WebCatalog2 Feature Request (1996)
WebCatalog/Mac 2.1b2 New Features (1997)
Mozilla/4. and Browser Info.txt (1997)