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 you don't change it. The only way to sort such a date is alphbetically as a text string (unless your default date format is %B %d, %Y -- and I'm not even sure if it would work then); even if you're only sorting dates within the 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'll find 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 be able to correctly sort the values (by comparing them either as datetype=date or datetype=num), but many more complex and highly useful math calculations become possible. These formats (especially the number of days since 00/00/0000) are also easier for WebCat to parse, so your searches 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:

    
  1. Re: Sort of a Dilema! (Kenneth Grome 1998)
  2. Re: Sort of a Dilema! (Terry Wilson 1998)
  3. Re: Sort of a Dilema! (Dave MacLeay 1998)
  4. Sort of a Dilema! (The Mooseman 1998)
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 you don't change it. The only way to sort such a date is alphbetically as a text string (unless your default date format is %B %d, %Y -- and I'm not even sure if it would work then); even if you're only sorting dates within the 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'll find 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 be able to correctly sort the values (by comparing them either as datetype=date or datetype=num), but many more complex and highly useful math calculations become possible. These formats (especially the number of days since 00/00/0000) are also easier for WebCat to parse, so your searches 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)