Changing Time format
Hi All
I want to change format of system Time display by my program
for example if format of system time is "hh:mm:ss AM"(12 hour clock format) I want to change it to "HH:mm:ss"(24 hour clock format)
is any solution for this purpose?
thanks
fayyaz
Junior Poster in Training
66 posts since Jun 2007
Reputation Points: 12
Solved Threads: 10
thankyou my frend
it is a good method for changing time format
but i need to an instruction that change format of system time that runing application be caus to changing windows time format
fayyaz
Junior Poster in Training
66 posts since Jun 2007
Reputation Points: 12
Solved Threads: 10
thankyou my frend
it is a good method for changing time format
but i need to an instruction that change format of system time that runing application be caus to changing windows time format
You must to use SetLocaleInfo function from Win32 API.
ex.:
procedure SetTimeFormat(tfType24 :Boolean)
var
Changed :Boolean;
LCID :LongInt;
begin
LCID := GetSystemDefaultLCID;
if ftType24 then // if format type is 24 hours...
Changed := SetLocaleInfo(LCID, LOCALE_STIMEFORMAT, 'HH:mm:ss')
else // if format type is 12 hours AM/PM
Changed := SetLocaleInfo(LCID, LOCALE_STIMEFORMAT, 'hh:mm:ss');
if Changed then // if no error then notify all app that settings changed
SendMessage(HWND_TOPMOST, WM_SETTINGCHANGE, 0, 0);
end;
bye.
Micheus
Junior Poster in Training
72 posts since Jun 2006
Reputation Points: 10
Solved Threads: 4