NewLearner,
真巧,我今天才用到符合你答案的函数——楼上的兄弟的答案都对但都麻烦。:)
我程序中的例子:
function curTime: string;
var
Present: TDateTime;
Year, Month, Day, Hour, Min, Sec, MSec: Word;
timeStr, dayStr: string;
begin
Present:= Now;
DecodeDate(Present, Year, Month, Day);//分解年月日
dayStr := '今天是'+inttostr(Year)+'年'+inttostr(Month)+'月'+
inttostr(Day)+'日';DecodeTime(Present, Hour, Min, Sec, MSec);
DecodeTime(Present, Hour, Min, Sec, MSec);//分解时分秒和毫秒
timeStr := ' 现在时间:' + inttostr(Hour)+'时'+inttostr(Min)+'分';
Result := dayStr + ' ' + timeStr;
end;
应用:
MainFm.Caption:=curTime;
呵呵,拿分来