16-10-24 09:04 AM
Hi,
I have two date times, say Date Time 1 = 03-09-2024 08:19:04 and Date Time 2 = 10-09-2024 21:18:15
I need to do a calculation Date Time 1 - Date Time 2. Currently I am getting output as 7.12:59:11 - I understand here 7 is day, 12 Hours, 59 minutes and 11 seconds.
I need the result in hours:minutes:seconds format - 180:59:11 (24X7 +12 = 180 hours).
Is there any way to achieve this, other than split and use Create date time method?
Blue Prism Trial Blue Prism Enterprise v7
Thanks,
Dipin Dev P
Answered! Go to Answer.
16-10-24 09:37 AM - edited 16-10-24 09:39 AM
@DipinDevP Hello
Try this :
DateDiff(7, [Data1], [Data2])&Mid([Data1]- [Data2],InStr([Data1]- [Data2],":"),Len([Data1]- [Data2]))
16-10-24 09:31 AM
Top of my head, I'd probably store the the time as text, then play around with the text left/mid functions to isolate the days and hours and store them into number fields, multiply them, then join everything together in a string in the new format you want. There probably is a nicer way but things like this are not worth spending too long over as the time improvements at runtime would be microseconds.
16-10-24 09:37 AM - edited 16-10-24 09:39 AM
@DipinDevP Hello
Try this :
DateDiff(7, [Data1], [Data2])&Mid([Data1]- [Data2],InStr([Data1]- [Data2],":"),Len([Data1]- [Data2]))
16-10-24 09:58 AM
@DipinDevP it worked for you ?
please put best answer if yes 🙂
16-10-24 10:11 AM
@Denis__Dennehy @Mohamad_747 Thanks for your quick response, both suggestions helped me a lot!
@Mohamad_747 Yes. It is worked. 🙂