showmessage( formatdatetime('YYYY/MM/DD',strtodatetime('9-1'))) xp 用这个

showmessage( formatdatetime('YYYY/MM/DD',strtodatetime('9/1'))) xp 用这个

//----------win7 用下面的

Function getMilliSecond: String;
var
a : Longint;
b : String;//毫秒数
t1,t2:tdatetime;
fs:TFormatSettings;
begin

fs.ShortDateFormat:='yyyy-mm-dd hh:MM:ss';
fs.DateSeparator:='-';

//StrtoDateTime('1970-01-01 0:00:00');
t1:= StrtoDatetime('1970-01-01 8:00:00',fs);
//t1:= StrtoDateTime('1970-01-01 8:00:00'); //百度发文章时间
//t1:= StrtoDateTime('1968-08-30 10:00:00'); //qq时间
//t1:= StrtoDateTime('1970-01-16 9:59:37'); // 百度贴吧
//t1:=StrtoDateTime('2000-01-01 0:00:00');
t2:=now;
b := FloatToStr(MilliSecondsBetween(t2,t1));//取秒差
// a := a * 60;//取秒差
// b := IntToStr(a) + '000';//将秒差结果后缀加上三个零(等于毫秒数)
Result := b;
end;