Conditional value formatting for dates difference in days, hours, minutes, seconds and milliseconds.

I have two dates, the difference of this would be my time difference and this can be as big as 30+ days and small as 10 milliseconds. Example is given below,

time_1 : 2023-10-20 14:31:31.693000 UTC

time_2:2023-10-20 14:31:31.793000 UTC

time_3: 2023-10-23 16:41:41.793000 UTC

time_2 - time_1 = 100ms

time_3 - time_1 = 3d 2h 10m 10s 100ms

I want to display 100 ms in first case and 3d 2h 10m 10s 100ms in second case. Can someone help with this.

0 0 302