Home > Back-end >  Delphi mm - dd yyyy - hh: mm: ss and the number of seconds to swap
Delphi mm - dd yyyy - hh: mm: ss and the number of seconds to swap

Time:10-12

Such as: yyyy - in the Delphi - dd hh: mm mm: ss and the number of seconds how to swap to 1970.1.1 0:0:0 for starting time
Urgent please

CodePudding user response:

 
Var
SDt, eDt: TDateTime;
D: Extended;
The begin
SDt:=StrToDateTime (' 1970-01-01 00:00:00);
EDt:=Now;
D:=(eDt - sDt) * 24 * 60 * 60;
ShowMessage (FloatToStr (d));//get the 1970-01-01 00:00:00 has the number of seconds, rounding up

CodePudding user response:

The
reference
var
SDt, eDt: TDateTime;
D: Extended;
The begin
SDt:=StrToDateTime (' 1970-01-01 00:00:00);
EDt:=Now;
D:=(eDt - sDt) * 24 * 60 * 60;
ShowMessage (FloatToStr (d));//get the 1970-01-01 00:00:00 up to now the number of seconds, rounding up

Support positive solution,

CodePudding user response:

DateUtils. MilliSecondsBetween (vDateTime1 vDateTime2);

CodePudding user response:

LS this is milliseconds, want to use with SecondsBetween,
But if there is no more time to calculate demand there is no need to introduce additional DateUtils units, increase the size of the compiled file
  • Related