PDA

View Full Version : semi-generic dateformat



stanl
06-24-2008, 04:48 AM
The attached workbook contains a vba function, a few test rows and an explanation of the format mask. I adopted this to vba code but it appears to work as expected. I do significant SQL Server/Oracle datetime processing and often require some non-standard formats for output data [checks, ascii files, Word/Excel documents.

The function will accept either: (1) a date string recognized by the isdate() function (2) a numeric offset - 0 as current date - from current date (3) a Datetime field. It uses pseudo-regular expressions to format output.

It parses in the American mm/dd/yyy hh:mm:ss format, and if someone can tweak it to accept European or Japanese format it would become even more generic. At least it's fun to play with - Stan