如何将一个字符串格式化为一个日期,指定格式的

2022-03-10 社会 97阅读
var
str:string;
outDate:TDateTime;
FormatSettings:TFormatSettings;
begin
str:='07/06/200610:10:10';
//DateTimePicker1.DateTime:=StrToDateTimeDef(str,now,'mm/dd/yyyyHH:MM:SS');
FormatSettings.DateSeparator:='/';
FormatSettings.TimeSeparator:=':';
//FormatSettings.:='mm/dd/yyyyHH:MM:SS'
FormatSettings.ShortDateFormat:='mm/dd/yyyy';
FormatSettings.ShortTimeFormat:='hh:mm:ss';
TryStrToDateTime(str,outdate,FormatSettings);
DateTimePicker1.DateTime:=outDate;
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com