Reinaldo's question about dates earlier this month (see message #4185) made me realize that we need additional date functions in Maptitude. I've taken a stab at fixing (at least part of) that problem with a new utility that I call the DateWidget. This utility consists of five macros: two of these are primarily for demonstration purposes (and can be removed from the code without harm), while the other three do the real work.
This tool is available for download at Directions Magazine (http://www.directionsmag.com/files/view/datewidget-0.25/166705). Free and open source; GPLv3 license. "Test" is a simple demo allowing you to explore the functionality of DateWidget (just play with the input and output formats in the administrative settings). "Date Field" provides a more applied demo of the DateWidget. This macro adds a new field (whose name is specified in the administrative settings) to hold the widgetized date (whose format is also specified in the administrative settings). It will then loop through all records, read the contents of the date field, and then write the widgetized date in the format specified in the options. The "Sample_dates.bin" file is provided as demo data. "DateWidget" is the main macro. It converts dates from all-numeric formats, e.g. 2/14/2011 to formats such as February 14, 2011. If you use the string "today" for a date, it will produce today's date in the desired format. The macro takes two options related to input: date type (e.g. MDY vs. DMY) and separator (e.g. 2/14/2011 vs. 2-14-2011). It also accepts five options related to output: format (e.g. Monday, February 14, 2011 vs. 14-02-2011); day (include day of week if format is not otherwise specified); longmonth (e.g. Feb vs. February); zeroes (02/01/2011 vs. 2/1/2011); and language (English, French, Spanish, and, in Reinaldo's honor for raising the question, Portuguese are currently supported-- assuming I got the spellings all correct). "DOW" is a helper macro for DateWidget, but may also be used separately. It macro converts an English day of the week to another language. The first parameter, american_date, is a date of the form "MM/DD/YYYY". The second parameter, days, is an array of days of the week in the target language, beginning with Sunday. "Today" is another helper macro for DateWidget that may be used separately. It gets today's date using Maptitude's GetDateAndTime() function and converts it into an American-style (MM/DD/YYYY) date-- the format Maptitude requires for its built-in date functions. ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/Maptitude/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/Maptitude/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
