Is there a way to find out the system time format? (If it's 24hour or 12 hour)
Thanks :D
Printable View
Is there a way to find out the system time format? (If it's 24hour or 12 hour)
Thanks :D
Are you looking for this one ?
vb Code:
Dim strDateFomrat As String = System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern
Not really, that line gets the Date format and I'm trying to get the Time format... But thanks! I can use it :D
So I changed it to:
And it shows "H:mm:ss", but how do I retrieve if it's 24 hours or 12 hours?Code:Dim strDateFomrat As String = System.Globalization.DateTimeFormatInfo.CurrentInfo.LongTimePattern
How exactly do you want to use it? The best way to "get" the format depends on how you want to use it.
That said, if you want the actual format string being used then you get it from Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern and/or .LongTimePattern. If it's 24H time then it will use H rather than h and there will be no tt part for AM/PM.
Oh, so 24H time = H and 12h time = h? If that's so, can I use an if statement or select case to do something after it checks the format?
I'm curious, why do you need this information and what will you use it for?
You can format dates and times any way you like, including the default format without knowing the actual default format.
(essentially, there's probably an easier way of doing what you want).
If this is the case, then it doesn't matter what the computer format is set to. Just check the current 'Now' time and it'll give you the time.
Remember, the computer 'date/time' settings are purely for display. A Time (as in DateTime object) is a time, regardless of these regional settings, database, phase of the moon or time zone.
In other words, if I set the alarm to 23:30, it'll go off even if the time on the system is 11:30?
The time is the time. The way the time is displayed makes no difference, other than to how it's displayed.
Yeah, I just verified that. I was going to post just what you said. Thanks a lot guys!