D dafuwengqing Unregistered / Unconfirmed GUEST, unregistred user! 2010-01-27 #1 各位大侠: 我现在有秒数31200,我希望把它写到数据库的datetime类型字段中成为2010-1-27 8:40:00,其中2010-1-27 为系统日期,谢谢了!
D dullhe Unregistered / Unconfirmed GUEST, unregistred user! 2010-01-27 #2 function UINT2DateTime(Value:UINT):TDateTime;begin result:=IncSecond(BASEDATETIME,Value);end;BASEDATETIME:=??????自己求就是了SecondsBetween(2010-1-27 8:40:00,BASEDATETIME)=31200????求出BASEDATETIME,代人函数
function UINT2DateTime(Value:UINT):TDateTime;begin result:=IncSecond(BASEDATETIME,Value);end;BASEDATETIME:=??????自己求就是了SecondsBetween(2010-1-27 8:40:00,BASEDATETIME)=31200????求出BASEDATETIME,代人函数
Z zbdzjx Unregistered / Unconfirmed GUEST, unregistred user! 2010-01-27 #3 思路:1、先取当前日期,转换成字符串。2、将日期字符串加上“00:00:00”,再转换回日期时间类型。3、再将转换后的日期时间类型加上31200/3600/24,就得到结果了。
L liuls Unregistered / Unconfirmed GUEST, unregistred user! 2010-01-28 #4 uses DateUtils;procedure TForm1.btn1Click(Sender: TObject);var DateTime: TDateTime;begin DateTime := IncSecond(DateOf(Now()), 31200) // IncSecond(StrToDateTime('2010-1-27'), 31200) Caption := DateTimeToStr(DateTime);end;
uses DateUtils;procedure TForm1.btn1Click(Sender: TObject);var DateTime: TDateTime;begin DateTime := IncSecond(DateOf(Now()), 31200) // IncSecond(StrToDateTime('2010-1-27'), 31200) Caption := DateTimeToStr(DateTime);end;
S sdqdzt Unregistered / Unconfirmed GUEST, unregistred user! 2010-01-29 #6 procedure TForm1.Button1Click(Sender: TObject);begin Caption:=DateToStr(Now)+' '+TimeToStr(31200/(3600*24));end;
procedure TForm1.Button1Click(Sender: TObject);begin Caption:=DateToStr(Now)+' '+TimeToStr(31200/(3600*24));end;