2

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 1

2

This should give you the DateTime formats for the machine's current culture:

[cultureinfo]::CurrentCulture.DateTimeFormat
Sign up to request clarification or add additional context in comments.

2 Comments

Or better yet, ([cultureinfo]::CurrentCulture.DateTimeFormat).LongDatePattern
If you get an error using the [CultureInfo] type accelerator, spell it out: [System.Globalization.CultureInfo].

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.