Re: separate by mont (search)
This WebDNA talk-list message is from 2002
It keeps the original formatting.
numero = 46454
interpreted = N
texte = >>1. In a database I have one of the entries as a date in this format>>mm/dd/yyyy.>>No matter what other methods you use to store dates in a db, it is always a good idea to store the month, day and year in three separate fields in your db's ... for the exact reason that you've described here:There can be some advantages, but it's certainly not necessary. If it's not being done that way now I wouldn't change it.>>>3. The customer wants to be able to display information by month>>4. A search should display the months ie: Jan, Feb, Mar, Apr, etc..>>There is a way -- but it is convoluted and unintuitive at best, and I disposed of it as a standard coding technique years ago -- in favor of storing my dates in three separate fields.How is this convoluted:[loop start=1&end=12][lookup db=int2month.db&lookinfield=int&value=[index]&returnfield=month][/loop]?>>It is far simpler to store the three components of a date in three separate fields. Not only does this make all kinds of date searches extremely easy to code (and easy to modify or debug), it also means you can use three popup fields for dates in all your forms, with each form field corresponding directly to one of your three date component fields.>>By the way, if you happened to store your dates as the number of days since 0000 via the [math]{[date]}[/math] technique, there's no reasonable way to extract the values in a particular month -- so this technique is not good at all for searching by a particular month or year ...Actually, if you did do this it is extremely easy to find all the january records. Just do an integer search greater than or equal to [math]{[month]/1/[year]}[/math] and less than [math]{[month]/1/[year(maybe +1)]}[/math] - This is extremely fast and simple.-- --------------------------------- John A. Hill Oak Hill SoftwareWebsite Development/Consulting john@oakhillsoftware.com-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list
.To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
>>1. In a database I have one of the entries as a date in this format>>mm/dd/yyyy.>>No matter what other methods you use to store dates in a db, it is always a good idea to store the month, day and year in three separate fields in your db's ... for the exact reason that you've described here:There can be some advantages, but it's certainly not necessary. If it's not being done that way now I wouldn't change it.>>>3. The customer wants to be able to display information by month>>4. A search should display the months ie: Jan, Feb, Mar, Apr, etc..>>There is a way -- but it is convoluted and unintuitive at best, and I disposed of it as a standard coding technique years ago -- in favor of storing my dates in three separate fields.How is this convoluted:[loop start=1&end=12][lookup db=int2month.db&lookinfield=int&value=[index]&returnfield=month][/loop]?>>It is far simpler to store the three components of a date in three separate fields. Not only does this make all kinds of date searches extremely easy to code (and easy to modify or debug), it also means you can use three popup fields for dates in all your forms, with each form field corresponding directly to one of your three date component fields.>>By the way, if you happened to store your dates as the number of days since 0000 via the [math]{[date]}[/math] technique, there's no reasonable way to extract the values in a particular month -- so this technique is not good at all for searching by a particular month or year ...Actually, if you did do this it is extremely easy to find all the january records. Just do an integer search greater than or equal to [math]{[month]/1/[year]}[/math] and less than [math]{[month]/1/[year(maybe +1)]}[/math] - This is extremely fast and simple.-- --------------------------------- John A. Hill Oak Hill SoftwareWebsite Development/Consulting john@oakhillsoftware.com-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
John Hill
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:
Creating main- and sub-category search (1997)
WC2f3 (1997)
Show shoppingcart after remove last item (1997)
AccountAuthorizer doesn't seem to work (1997)
[WebDNA] Why doesn't this returnraw redirect to the new page? (2009)
Default error page (2002)
Bug Report, maybe (1997)
WC2.0 Memory Requirements (1997)
E-mail Attachments (1997)
[WebDNA] WebDNA ImageMagick Functions (2009)
writing db to disk (1997)
Shared conversion under WebTen (1998)
WebCatalog stalls (1998)
Postdata expired from cache (2004)
Auto entering Friday's date in a field (2002)
Username/Password with [Protect] (2000)
WebCat 3? (2000)
Requiring that certain fields be completed (1997)
Digest Version (2000)
counting characters and/or words (1997)