RE:math context ignores date prefs?

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 21003
interpreted = N
texte = Matthias:>I am thinking that the math context does not handle date formats properly. >Or am I doing something wrong?You're not doing anything wrong. However, you are running into some things that could probably be improved, are not necessarily bugs, but have work-arounds that make everything work correctly.>A [math]{[date]}[/math] returns 13.11 Hmm. Seems to be treated as >floating point. so...We use {} to designate both dates and times. Thus we need a bit of intelligence to determine whether the string is a date or time. The way we decide is if the separators between the numbers are : or . then it is a time. The reason a period is a time separator is because a decimal number of seconds is possible (ie. 13.11 seconds). I realize that periods between date componants is common, so here's how to work around this issue (for now, in the future we will probably provide more explicit support for this). Create a very small convertchars database that converts . to / and run the date string through the convertchar database inside the curly brackets. Like the following:[math]{[convertchars db=DateConv.db]13.11.1998[/convertchars]}[/math]Convertchars is very fast, so this doesn't slow things down appreciably.>[math date]{[date]}[/math] returns 01/11/0000. Huh?>[math date]{[date %d/%m/%y]}[/math] returns 13/11/1998. Good date. Wrong >format. should be 13.11.1998.Both of these are due to the limited scope of the date tag in the [math] context. Rather than do this, use the more flexible [format] context to write the date out correctly. That is,[format days_to_date %d/%m/%Y][math]{[convertchars db=DateConv.db]13.11.1998[/convertchars]}[/math][/format]I hope this helps.John. John A. Hill, V.P. Marketing Pacific Coast Software eCommerce / Web Developer Tools http://www.smithmicro.com Associated Messages, from the most recent to the oldest:

    
  1. RE:math context ignores date prefs? (John Hill 1998)
Matthias:>I am thinking that the math context does not handle date formats properly. >Or am I doing something wrong?You're not doing anything wrong. However, you are running into some things that could probably be improved, are not necessarily bugs, but have work-arounds that make everything work correctly.>A [math]{[date]}[/math] returns 13.11 Hmm. Seems to be treated as >floating point. so...We use {} to designate both dates and times. Thus we need a bit of intelligence to determine whether the string is a date or time. The way we decide is if the separators between the numbers are : or . then it is a time. The reason a period is a time separator is because a decimal number of seconds is possible (ie. 13.11 seconds). I realize that periods between date componants is common, so here's how to work around this issue (for now, in the future we will probably provide more explicit support for this). Create a very small convertchars database that converts . to / and run the date string through the convertchar database inside the curly brackets. Like the following:[math]{[convertchars db=DateConv.db]13.11.1998[/convertchars]}[/math]Convertchars is very fast, so this doesn't slow things down appreciably.>[math date]{[date]}[/math] returns 01/11/0000. Huh?>[math date]{[date %d/%m/%y]}[/math] returns 13/11/1998. Good date. Wrong >format. should be 13.11.1998.Both of these are due to the limited scope of the date tag in the [math] context. Rather than do this, use the more flexible [format] context to write the date out correctly. That is,[format days_to_date %d/%m/%Y][math]{[convertchars db=DateConv.db]13.11.1998[/convertchars]}[/math][/format]I hope this helps.John. John A. Hill, V.P. Marketing Pacific Coast Software eCommerce / Web Developer Tools 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:

errormessages.db (1997) [movefile] create stationery files (1998) _ in front of field name (1998) [WebDNA] Show next..... (2010) Cold Fusion Buster (1997) Active Server Code... (1998) Solution help needed (1998) Setting up shop (1997) [WebDNA] eCommerce in 7.0 but not in 7.1? (2012) RE: shrink-wrapped version out yet? (1997) Misc Stuff That Might Help (1997) Extended [ConvertChars] (1997) Delete Context - to remove record (1998) [WebDNA] Re:BCC and/or Character limit [sendmail] (2010) Emailer problem (1998) Configuration Q (1998) [date] inside orderfile (2000) textarea data entry and display (2000) RE: A zip code search (1998) Trouble with PIXO and Welcome Plugin (1999)