|
-
May 8th, 2009, 01:13 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Check System Time Format
Is there a way to find out the system time format? (If it's 24hour or 12 hour)
Thanks
-
May 8th, 2009, 01:22 AM
#2
Re: Check System Time Format
Are you looking for this one ?
vb Code:
Dim strDateFomrat As String = System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern
Please mark you thread resolved using the Thread Tools as shown
-
May 8th, 2009, 01:25 AM
#3
Thread Starter
Fanatic Member
Re: Check System Time Format
Not really, that line gets the Date format and I'm trying to get the Time format... But thanks! I can use it 
So I changed it to:
Code:
Dim strDateFomrat As String = System.Globalization.DateTimeFormatInfo.CurrentInfo.LongTimePattern
And it shows "H:mm:ss", but how do I retrieve if it's 24 hours or 12 hours?
-
May 8th, 2009, 01:34 AM
#4
Re: Check System Time Format
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.
-
May 8th, 2009, 07:39 AM
#5
Thread Starter
Fanatic Member
Re: Check System Time Format
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?
-
May 8th, 2009, 08:25 AM
#6
Re: Check System Time 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).
"Ok, my response to that is pending a Google search" - Bucky Katt.
"There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
"Before you can 'think outside the box' you need to understand where the box is."
-
May 8th, 2009, 08:38 AM
#7
Thread Starter
Fanatic Member
Re: Check System Time Format
 Originally Posted by SJWhiteley
I'm curious, why do you need this information and what will you use it for?
I'm making a program to shutdown the computer at a given time/date, but since my computer time format is 24H, I wanted to be able to give the app the "ability" to check the time format of the system and go on from there.
-
May 8th, 2009, 09:40 AM
#8
Re: Check System Time Format
 Originally Posted by tassa
I'm making a program to shutdown the computer at a given time/date, but since my computer time format is 24H, I wanted to be able to give the app the "ability" to check the time format of the system and go on from there.
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.
"Ok, my response to that is pending a Google search" - Bucky Katt.
"There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
"Before you can 'think outside the box' you need to understand where the box is."
-
May 8th, 2009, 10:45 AM
#9
Thread Starter
Fanatic Member
Re: Check System Time Format
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?
-
May 8th, 2009, 10:49 AM
#10
Re: Check System Time Format
The time is the time. The way the time is displayed makes no difference, other than to how it's displayed.
-
May 8th, 2009, 10:58 AM
#11
Thread Starter
Fanatic Member
Re: Check System Time Format
Yeah, I just verified that. I was going to post just what you said. Thanks a lot guys!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|