,可以通过以下步骤实现:
var
FormatSettings: TFormatSettings;
begin
FormatSettings := TFormatSettings.Create;
FormatSettings.TimeAMString := '上午';
FormatSettings.TimePMString := '下午';
var
TimeValue: TDateTime;
TimeString: string;
begin
TimeValue := Now; // 假设要格式化当前时间
TimeString := FormatDateTime('hh:mm:ss am/pm', TimeValue, FormatSettings);
ShowMessage(TimeString); // 显示格式化后的时间字符串
end;
上述代码中的'hh:mm:ss am/pm'是时间格式字符串,其中'hh'表示小时(12小时制),'mm'表示分钟,'ss'表示秒,'am/pm'表示上午或下午。
这样,就可以在Delphi 10.3 Rio中将24小时格式更改为12小时。对于其他时间格式的需求,可以根据需要调整时间格式字符串。
腾讯云相关产品和产品介绍链接地址:
领取专属 10元无门槛券
手把手带您无忧上云