The Shadow Posted June 23, 2007 Posted June 23, 2007 Here's another "object", implemented via custom functions using repeating global variables for storage. This one implements a date formatter similar to the c-library function strftime(), which uses % as an indicator of a special char to fill in. So for example, the call: FormatData( ; "Short year: %y weekday number: %u day of year: %j"; GetAsDate( “11/22/1976” ) ) Returns the result: Short year: 76 weekday number: 2 day of year: 327 The formatter maintains the text style present in the format, and new format code letters can easily be added. The current supported format letters are: %A - full weekday name %a - abbr weekday name %B - full month name %b - abbr month name %C - year / 100 with leading zero for single digits %D - %m/%d/%y %d - day as decimal number (01->31) %F - %Y-%m-%d %j - day of year (001->366) %M - minute (00->59) %m - month as number (01->12) %u - weekday as number (Sunday is first 1->7) %Y - year %y - year with no century %% - literal % %H - hour (24 hour) %I - hour, 12-hour clock %S - second (00->60) %T - %H:%M:%S %p - AM/PM %J - %Y+%m+%d (japanese date format) I've attached an example file that contains a more information and a short tutorial. DateFormatter.fp7.zip
Recommended Posts