Get just the hour of day from DateTime using either 12 or 24 hour format as defined by the current c
- by InvisibleBacon
.Net has the built in ToShortDateString() function for DateTime that uses the CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern format. It returns something like this for en-US: "5:00 pm". For a 24 hour culture such as de-DE it would return "17:00".
What I want is a way to just return just the hour (So "5 pm" and "17" in the cases above) that works with every culture. What's the best/cleanest way to do this?
Thanks!