Jump to content
Sign in to follow this  
JDS2018

Date Time Diff

Recommended Posts

Hi Can you help to on below

Start Date and time : 1/1/2018 3:30:00 PM
End Date and time : 2/1/2018 4:35:00 PM

I Need to Get Result as below

Example Answer Should be
1 Day 1 Hour 5 Mints

Share this post


Link to post
program Project458;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils,
  System.TimeSpan;

var
  span: TTimeSpan;
begin
  span := TTimeSpan.Subtract(EncodeDate(2018,1,2)+EncodeTime(16,35,0,0), EncodeDate(2018,1,1)+EncodeTime(15,30,0,0));
  Writeln(Format('%d Day(s) %d Hour(s) %d Minute(s)', [span.Days, span.Hours, span.Minutes]));
  Readln;
end.

 

  • Like 1

Share this post


Link to post
Guest
This topic is now closed to further replies.
Sign in to follow this  

×