如何设置系统时间的格式?(30分)

V

victor

Unregistered / Unconfirmed
GUEST, unregistred user!
如何在delphi中设置系统时间的格式,
如设置24小时制或12小时制?
 
使用FormatDateTime函数即可

function FormatDateTime(const Format: string; DateTime: TDateTime): string;

{ FormatDateTime formats the date-and-time value given by DateTime using the
format given by Format. The following format specifiers are supported:
 
先谢了!
但我说的是修改系统(如win95中的)时钟的显示格式,
我不希望出现系统时钟中不出现am, pm之类的显示
 
只有一个地方--------Registry!
 
能说具体一点吗?
 
快给我加分!!!
为了这个KEY我找了好久!
/key_current_user/Control Panel/International/sShortDate
 
Hehe, 更好的方法是使用API:
SetLocaleInfo
Set the value which Type is LOCALE_SSHORTDATE
 
请问SetLocaleInfo中的参数如何用?

谢谢!
 
呜呜, 只有30分哪!

SetLocaleInfo(
LOCALE_USER_DEFAULT,
LOCALE_STIME,
"tt hh:mm:ss"
);

改完之后不要忘了广播一条
WM_SETTINGCHANGE
消息
 
多人接受答案了。
 
讨论结束
pegasus:你说的广播消息,如何实现?
谢谢
 
It's easy:

SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, NULL, NULL);

then the taskbar clock or other well-done application will automatically reload
the system setting, :)
 
顶部