February 27th, 2014, 08:00 AM
I need to calculate the amount of hours (or minutes) between 2 dates and 2 times. There are 4 objects (datetime pickers) on the form.
This should read 450 min or 7.5 hours. I just need the integer (number) 450.
How would on go by doing this?
Ive tried to figure this out. First i need to see if the 2 dates is on the same day. If not the 1t date should be BEFORE the 2nd date.
If its the same day i assume the calculation should be easy and obviously the outcome should be les than 24 hours (1440) min. BUT I HAVE NO IDEA WHERE TO START?
Thanks in advanced!
February 27th, 2014, 02:03 PM
There's a function called MinutesBetween that is already part of Delphi. You'll need to add System.DateUtils or (DateUtils if pre-XE2) to your Uses clause.
Last edited by majlumbo; February 27th, 2014 at 02:36 PM.
February 27th, 2014, 11:49 PM
Thanks majlumbo. It worked like a charm. Thank you so much you always helped me alot with your replies. I have another Time date issue which i will create a new post for. But first let me see if i can sort it out with this procedure in the dateutils. Thanks again