How to get clock system of a device in C#? (12-hour or 24-hour)

Viewed 55

I want to show a date to the users in my app. Some users may use 12-hour system, some may use 24-hour system. How can I get if the user's system is using 12-hour system or 24-hour system, so that I can print a date depending on that?

1 Answers

.Net gets DateTime formats directly from OS. You can use ToShortTimeString() or ToLongTimeString() methods to get representation of user.

DateTime.Now.ToShortTimeString()
Related