时间格式格式化的问题(50)

  • 主题发起人 主题发起人 Ekin
  • 开始时间 开始时间
E

Ekin

Unregistered / Unconfirmed
GUEST, unregistred user!
Application.Initialize; DateSeparator := '/'; TimeSeparator := ':'; LongTimeFormat :='hh:mm:ss'; ShortTimeFormat:='hh:mm:ss'; Application.CreateForm(TMainFrom, MainFrom); Application.Run; 已经在工程文件中加了这个格式化时间的语句,为何程序在有些机器上还是显示格式如“上午 10:24:44”,为什么“上午”或“下午”两个字没去掉啊!
 
try setlocaleinfo(getthreadlocale,LOCALE_SSHORTDATE,'yyyy-MM-dd'); PostMessage(HWND_BROADCAST,WM_SETTINGCHANGE,0,0); except end; 设置日期格式此可作参考
 
'hh:mm:ss'应为'HH:mm:ss'要大写~~
 
to :zkktom 不想改用户的设置,怕影响到用户其他的程序to :de410 按你说的区分大小写的话,我手工在控制面板 区域语言选项中改大写或小写都没看出什么变化啊!感谢大家,还网赐教!
 
hh:为12小时制分上下午HH:为24小时制,不会出现上下午~~以下为delphi 上的英文解释hh The two-digit hour in 12-hour format. Single-digit values are preceded by a zero. HH The two-digit hour in 24-hour format. Single-digit values are preceded by a zero. 看以下帖子上的解释http://www.delphibbs.com/delphibbs/dispq.asp?lid=3971657
 
谢谢 c Displays the date using the format given by the ShortDateFormat global variable, followed by the time using the format given by the LongTimeFormat global variable. The time is not displayed if the date-time value indicates midnight precisely.d Displays the day as a number without a leading zero (1-31).dd Displays the day as a number with a leading zero (01-31).ddd Displays the day as an abbreviation (Sun-Sat) using the strings given by the ShortDayNames global variable.dddd Displays the day as a full name (Sunday-Saturday) using the strings given by the LongDayNames global variable.ddddd Displays the date using the format given by the ShortDateFormat global variable.dddddd Displays the date using the format given by the LongDateFormat global variable.e (Windows only) Displays the year in the current period/era as a number without a leading zero (Japanese, Korean and Taiwanese locales only).ee (Windows only) Displays the year in the current period/era as a number with a leading zero (Japanese, Korean and Taiwanese locales only).g (Windows only) Displays the period/era as an abbreviation (Japanese and Taiwanese locales only).gg (Windows only) Displays the period/era as a full name. (Japanese and Taiwanese locales only).m Displays the month as a number without a leading zero (1-12). If the m specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.mm Displays the month as a number with a leading zero (01-12). If the mm specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.mmm Displays the month as an abbreviation (Jan-Dec) using the strings given by the ShortMonthNames global variable.mmmm Displays the month as a full name (January-December) using the strings given by the LongMonthNames global variable.yy Displays the year as a two-digit number (00-99).yyyy Displays the year as a four-digit number (0000-9999).h Displays the hour without a leading zero (0-23).hh Displays the hour with a leading zero (00-23).n Displays the minute without a leading zero (0-59).nn Displays the minute with a leading zero (00-59).s Displays the second without a leading zero (0-59).ss Displays the second with a leading zero (00-59).z Displays the millisecond without a leading zero (0-999).zzz Displays the millisecond with a leading zero (000-999).t Displays the time using the format given by the ShortTimeFormat global variable.tt Displays the time using the format given by the LongTimeFormat global variable.am/pm Uses the 12-hour clock for the preceding h or hh specifier, and displays 'am' for any hour before noon, and 'pm' for any hour after noon. The am/pm specifier can use lower, upper, or mixed case, and the result is displayed accordingly.a/p Uses the 12-hour clock for the preceding h or hh specifier, and displays 'a' for any hour before noon, and 'p' for any hour after noon. The a/p specifier can use lower, upper, or mixed case, and the result is displayed accordingly.ampm Uses the 12-hour clock for the preceding h or hh specifier, and displays the contents of the TimeAMString global variable for any hour before noon, and the contents of the TimePMString global variable for any hour after noon./ Displays the date separator character given by the DateSeparator global variable.: Displays the time separator character given by the TimeSeparator global variable.'xx'/"xx" Characters enclosed in single or double quotes are displayed as-is, and do not affect formatting.
 
后退
顶部