Re: More DateMath problems

This WebDNA talk-list message is from

1997


It keeps the original formatting.
numero = 13770
interpreted = N
texte = I see what's happening and can understand how it might look like a bug, but I don't think it is. Here's why. The code in WebCatalog sees the 0000 for the year and/or the 00 for the day and assumes the date in question is being added or subtracted to another date. When this occurs, it does it on a field by field basis so 1 month is either added or subtracted to the other date. This is different than converting the date to the number of days since X and adding or subtracting that. If you were to do that, then you would add a fixed number of days, 31 lets say, and the resulting date would not be the same as adding 1 month (sometimes 31 days is a month, sometimes it is a month and a day, sometimes it's a month and 3 days). So, in the example below, the date is being treated as a date (not something added or subtracted). Here's what WebCatalog thinks: The date is 1 day less that 1/1/0000, which is 12/31/-1. Thus the month is 12. The easy fix is to use 01 instead of 00 so the dummy date is always valid. I hope this helps.John.>The code: >[FORMAT Days_to_Date %m][MATH]{1/00/0000}[/MATH][/FORMAT] >[FORMAT Days_to_Date %m][MATH]{2/00/0000}[/MATH][/FORMAT] >[FORMAT Days_to_Date %m][MATH]{3/00/0000}[/MATH][/FORMAT] >[FORMAT Days_to_Date %m][MATH]{4/00/0000}[/MATH][/FORMAT] >[FORMAT Days_to_Date %m][MATH]{5/00/0000}[/MATH][/FORMAT] > >Returns: >12 >01 >02 >03 >04John A. Hill Pacific Coast Software 11770 Bernardo Plaza Ct. #453 * Web tools for Macintosh and WinNT * San Diego, CA 92128 http://www.smithmicro.com Associated Messages, from the most recent to the oldest:

    
  1. Re: More DateMath problems (Michael Winston 1997)
  2. Re: More DateMath problems (John Hill 1997)
  3. More DateMath problems (Michael Winston 1997)
  4. More DateMath problems (Michael Winston 1997)
  5. Re: More DateMath problems (grichter@panavise.com (Gary Richter) 1997)
I see what's happening and can understand how it might look like a bug, but I don't think it is. Here's why. The code in WebCatalog sees the 0000 for the year and/or the 00 for the day and assumes the date in question is being added or subtracted to another date. When this occurs, it does it on a field by field basis so 1 month is either added or subtracted to the other date. This is different than converting the date to the number of days since X and adding or subtracting that. If you were to do that, then you would add a fixed number of days, 31 lets say, and the resulting date would not be the same as adding 1 month (sometimes 31 days is a month, sometimes it is a month and a day, sometimes it's a month and 3 days). So, in the example below, the date is being treated as a date (not something added or subtracted). Here's what WebCatalog thinks: The date is 1 day less that 1/1/0000, which is 12/31/-1. Thus the month is 12. The easy fix is to use 01 instead of 00 so the dummy date is always valid. I hope this helps.John.>The code: >[FORMAT Days_to_Date %m][math]{1/00/0000}[/MATH][/FORMAT] >[FORMAT Days_to_Date %m][math]{2/00/0000}[/MATH][/FORMAT] >[FORMAT Days_to_Date %m][math]{3/00/0000}[/MATH][/FORMAT] >[FORMAT Days_to_Date %m][math]{4/00/0000}[/MATH][/FORMAT] >[FORMAT Days_to_Date %m][math]{5/00/0000}[/MATH][/FORMAT] > >Returns: >12 >01 >02 >03 >04John A. Hill Pacific Coast Software 11770 Bernardo Plaza Ct. #453 * Web tools for Macintosh and WinNT * San Diego, CA 92128 http://www.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:

Navigator Parsing (1997) Initiating NewCart (1997) Strange ShowIf behaviour (2001) Crash Log Question (2006) Fun with Dates - finally resolved but.... (1997) suffix mapping for NT? (1997) WebCat2b13 Mac plugin - [sendmail] and checkboxes (1997) RSS parser in WebDNA? (2006) [WebDNA] Now: Listfields does not work with tables - Was: [OT] MySQL Users (2011) Crazy dates (was: sorting dates) (1999) Help! WebCat2 bug (1997) Webten + Webcat running smooth (1998) 5.0 Pricing (2003) Why is [authenticate] not recognizing [username] on all sitedirectories? (2000) WebCat2b12 forgets serial # (1997) SMSI: databases corrupted on crash and permission issues on (2002) [WebDNA] OT - Wordpress Shopping Cart - will pay (2010) WebCatalog Technical Reference (1997) Nesting format tags (1997) Nested tags count question (1997)