Hi,
I want to calculate the difference in time(in minutes) between two dates. My dates are as attached
i want to see the total difference in minutes between Completion_Time and Complete_Before.
If Completion_Time is after the Complete_Before then return "Late"
if Completion_Time is before the Complete_Before then return "Early"
The tricky part is with the AM/PM part.
Solved! Go to Solution.
The following should do the trick @mboroto_89: - have attached the workflow too:
DateTimeDiff(DateTimeParse([Complete_Before], '%d %b %Y %I:%M:%S %p'),DateTimeParse([Completion_Time], '%d %b %Y %I:%M:%S %p'),'minute')
If you just want the raw difference, without negatives, then wrap it in abs(), like so:
abs(DateTimeDiff(DateTimeParse([Complete_Before], '%d %b %Y %I:%M:%S %p'),DateTimeParse([Completion_Time], '%d %b %Y %I:%M:%S %p'),'minute'))
And for the Early/Late flag, you can use:
if DateTimeParse([Completion_Time], '%d %b %Y %I:%M:%S %p') > DateTimeParse([Complete_Before], '%d %b %Y %I:%M:%S %p') then 'Late' else 'Early' endif
Thanks @AlexEntz the new dates will also play a role in my workflow, many thanks!
Thanks @grazitti_sapna this works as well
@mboroto_89 , thanks and glad it worked.
@DataNath @AlexEntz @grazitti_sapna using the Complete Before Column, are we able to get which day of the week this was? e.g Monday/Saturday?
@mboroto_89 this formula will help, DateTimeFormat([New Value ],"%A"). Just replace new value with the complete_before field.