function getsystemtime:tsystemtime tsystemtime=record year:word; month:word; day:word; hour min sec weekofday end;
var tm:tdatetime; year,month,day:word; begin tm:=date; decodedate(tm,year,month,day); edit1.text:=inttostr(year); edit2.text:=inttostr(month); edit3.text:=inttostr(day); end;
function time:tdatetime
datetimetostr(date+time);
function time:tdatetime
datetimetostr(date+time);
hh,mm,ss,mss:word;
tm:tdatetime;
begin
tm:=now;
decodetime(tm,hh,mm,ss,mss);
edit1.Text:=timetostr(tm)+' '+inttostr(mss);//mms是毫秒
end;
不是楼上说的那种组合的string格式
再来一次:
var
tm:tdatetime;
begin
tm:=date;//如果把date改为now会在原来的基础上加上时间
edit1.text:=datetimetostr(tm);end;
比如现在是十月,我要得到string类型的'10',分别得到月份,年份两个string.
tsystemtime=record
year:word;
month:word;
day:word;
hour
min
sec
weekofday
end;
tm:tdatetime;
year,month,day:word;
begin
tm:=date;
decodedate(tm,year,month,day);
edit1.text:=inttostr(year);
edit2.text:=inttostr(month);
edit3.text:=inttostr(day);
end;