How do I determine the users local system date format

Viewed 1230

I'm trying to determine the system date format from vb.net which must match the format which would be shown from cmd prompt.

Example, if you type date in cmd prompt (you may need to run it as admin) it will output the format required for the date change to take effect, similar to this:

The current date is: Sun 05/28/2017 Enter the new date: (mm-dd-yy)

My current date shown in my taskbar is also 05/28/2017

From vb.net, I need to find out the requested format, which in this case was mm-dd-yy.

I have tried System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern() which outputted dd/MM/yyyy which doesn't match the format.

2 Answers
Related