How can I use powershell to get the current system date format for example if I was reading a log file using powershell I would like to know if 2012-03-01 is in yyyy-mm-dd or yyyy-dd-mm.
1 Answer
This should give you the DateTime formats for the machine's current culture:
[cultureinfo]::CurrentCulture.DateTimeFormat
2 Comments
Austin T French
Or better yet,
([cultureinfo]::CurrentCulture.DateTimeFormat).LongDatePatternBill_Stewart
If you get an error using the [CultureInfo] type accelerator, spell it out: [System.Globalization.CultureInfo].