delphi中的strTodate()
时间:2020-10-06 20:11:33
收藏:0
阅读:46
delphi中StrToDate和当前操作系统设定的日期格式有关,格式不一致时,会抛出错误。
最好在调用时,强制转换,如下
var
t:TDateTime;
fs:TFormatSettings;
begin
fs.ShortDateFormat:=‘yyyy-mm-dd‘;
fs.DateSeparator:=‘-‘;
t := StrToDate(‘2010-01-01‘,fs);
评论(0)