George,
The first format string in the example below will format a DateTime object just like in the example you gave in your post. The format strings after that are just a few more ways to display the date using custom format strings:
dt = DateTime.Now
dt.ToString("MM-dd-yyyy hh:mm:ss.fffffff")
02-08-2007 03:16:22.5623750
dt.ToString("MM-dd-yyyy' 00:00:00.000'")
02-08-2007 00:00:00.000
dt.ToString("MMMM-dd-yyy")
February-08-2007
dt.ToString("MMM-dd-yyy")
Feb-08-2007
Another really neat feature of DateTime formatting in .Net is that the formatted strings that are produced can be culture specific.
Here is an example of formatting a DateTime object in both the English and French culture:
dt = DateTime.Now
dt.ToString("MM-dd-yyyy hh:mm:ss.fffffff")
02-08-2007 03:16:22.5623750
dt.ToString("MM-dd-yyyy' 00:00:00.000'")
02-08-2007 00:00:00.000
dt.ToString("MMMM-dd-yyy")
February-08-2007
dt.ToString("MMM-dd-yyy")
Feb-08-2007
using System
using System.Globalization
dt = DateTime.Now
ci = new CultureInfo("en-US")
dt.ToString("f", ci.DateTimeFormat) // Format the DateTime with en-US localization
Thursday, February 08, 2007 2:42 PM
ci = new CultureInfo("fr-FR")
dt.ToString("f", ci.DateTimeFormat) // Format the DateTime with fr-FR localization
jeudi 8 février 2007 14:42
dt.ToString("f", CultureInfo.CurrentCulture.DateTimeFormat) // Format the DateTime with the current localization of the system
Thursday, February 08, 2007 2:42 PM
dt.ToString("f") // if you do not specify the culture, it is by default the current system culture.
Thursday, February 08, 2007 2:42 PM
You can see that if you do not specify the specific culture to format your date with, the active default culture of the system is used. This would mean that if your software is running on a computer running the German version of windows, your date formatting would automatically output a date in the format that the user was accustomed to seeing on his computer.
So, the bottom line here is that your date processing gains almost immeasurable versatility when you use the built in DateTime object instead of manageing the dates your self as just a vector of numbers.
And the best part is that you can use []FMT to apply any of the format strings above to any array in Visual APL.
Fred