-
Jul 9th, 2018, 02:03 AM
#1
Thread Starter
Member
[RESOLVED] How know if the regional format uses 12 hours or 24 hours
Hello,
I would like to propose to users to use the regional format of the time for their PC.
Currently, I use FormatdateTime(…) but if he uses AM/PM ? :
Code:
FormatdateTime(cdate("20:42")) display "20:42" and not "8:42 PM"
1) How do I know if the regional format uses 12h ?
Then do I have to change FormatdateTime(..) to Format(… , "AM/PM") or use a function every time? like this :
Code:
Function GetGoodFormatHours(byval value as date) as string
if (HeUses12h) then
return Format( value , "AM/PM")
else
return FormatdateTime( value )
end if
end function
That would be a pity
thx
-
Jul 11th, 2018, 10:12 AM
#2
Hyperactive Member
Re: How know if the regional format uses 12 hours or 24 hours
I use "am/pm" and when I run FormatdateTime(cdate("20:42")) I get 8:42:00 PM so it is possible you may not need to make any changes. Dealing with multiple locales, date formats, decimal separators, etc are a huge pain and I would try and avoid making any changes if possible.
If you must make a change, LOCALE_ITIME will tell you what format they use: https://docs.microsoft.com/en-us/win...l/locale-itime
usage example: http://www.vbforums.com/showthread.p...ional-settings
also, you may get a faster responses posting in the main vb6 forum, not the code bank
-
Jul 11th, 2018, 12:33 PM
#3
Thread Starter
Member
Re: How know if the regional format uses 12 hours or 24 hours
Humm ok I try this ! Thanks you
-
Jul 12th, 2018, 01:40 AM
#4
Re: [RESOLVED] How know if the regional format uses 12 hours or 24 hours
Hi,
a simple check to see..
Code:
Private Sub Command1_Click()
'print to Form and see
Print GetDatumDE("12.07.2018 20:42")
Print GetDatumDE("07/12/2018 08:42 PM")
End Sub
Private Function GetDatumDE(vDatum As String) As String
If InStr(1, vDatum, "/") > 0 Then
'musst be Englisch then
GetDatumDE = Format(vDatum, "mm.dd.yyyy hh:nn:ss")
Else
GetDatumDE = Format(vDatum, "dd.mm.yyyy hh:nn:ss")
End If
End Function
regards
Chris
to hunt a species to extinction is not logical !
since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.
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
|