cancel
Showing results for 
Search instead for 
Did you mean: 

Time Span - Date Time to Time conversion

DipinDevP
Level 5

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

1 BEST ANSWER

Helpful Answers

@DipinDevP  Hello

Try this :

DateDiff(7, [Data1], [Data2])&Mid([Data1]- [Data2],InStr([Data1]- [Data2],":"),Len([Data1]- [Data2]))

View answer in original post

4 REPLIES 4

Denis__Dennehy
Level 15

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.

@DipinDevP  Hello

Try this :

DateDiff(7, [Data1], [Data2])&Mid([Data1]- [Data2],InStr([Data1]- [Data2],":"),Len([Data1]- [Data2]))

@DipinDevP  it worked for you ?

please put best answer if yes 🙂 

DipinDevP
Level 5

@Denis__Dennehy @Mohamad_747 Thanks for your quick response, both suggestions helped me a lot!

@Mohamad_747 Yes. It is worked. 🙂