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:

WebTV (1998) Ooops..Broswer Info.txt (was Web*SSL and WebCatalog) (1997) Re:affiliate marketing program (1998) Cart Number sequence (1997) [WebDNA] Cloud hosting and local development (2019) Country & Ship-to address & other fields ? (1997) WebCat2b13 Mac plugin - [sendmail] and checkboxes (1997) Shopping problems with 2.1b3 acgi (1997) [SearchString] problem with [search] context (1997) passwords not working (2000) HomePage Caution (1997) Serial Number Question (1997) Need relative path explanation (1997) WebCat2.0 acgi vs plugin (1997) WCS Newbie question (1997) File Upload (1997) I'm new be kind (1997) Database Not Writing Fully to Disk (2007) WebCat2: Items xx to xx shown, etc. (1997) NT considerations (1997)