Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change system time format 1

Status
Not open for further replies.

SirTECH

Technical User
Jul 24, 2005
42
CA
Is there a way to send a command to change the system time to 24-hour format?
The system time can be changed by using...

Time = #23:30#

But, if the local computer setting is using the am/pm format, the result returns...

11:30:00 PM

Of course within Access I can use Format(Time,"HH:nn") or the FormatDateTime(Time,vbShortTime), but that stays within ACCESS and is lost when the app closes.
It's not critical, but would be useful, not only for the ACCESS program, but for other applications. We're trying to ensure the 24-hour format is always used (eventually).
 
i suggest tans. the time in to a string so that it will stay the format you chose

I will try my best to help others so will others do!!!!!
IGPCS
Brooklyn, NY
 
Thank you for your reply. You are correct that changing the time to a string allow me to use whatever format I choose although I'm not sure what you mean by "tans. the time"
In any case, I'm not worried so much about the format while within ACCESS because I can deal with that easiliy enough. But, I'd like to use ACCESS to change the local machine's system time format to the 24-hour notation. It will save me from physically going around to all the network computers, especially in remote locations to change it through the Control Panel.
 
How are ya SirTECH . . .

There is an API ([blue]SetLocalInfo[/blue]) which can do this but the dangers are too great for me to post. I did use it for a while in the past and found it can cause problems in other applications.

Since your looking for a static format, why not [blue]set the format locally[/blue] (control panel) and using a [blue]system policy[/blue] [purple]hide the regional settings icon[/purple] in control panel?

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Thanks, TheAceMan1. SetLocaleInfo was what I was looking for. However, using a system policy IS the better way to go. So thank you for both answers!
 
SirTECH . . .

Note: the counterpart [blue]GetLocaleInfo[/blue] works just fine! [thumbsup2]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top