Hello,

I have following four datetime fields in my table:

Time_shipment_arrived, Time_shipment_unloaded, Time_shipment_logged, Time_shipment_finished.

During dataentry, the application only enters the "TIME" part in this field. That is, the fields look like this: "1900-01-01 20:55:48.000".

For one of my audit for 'operation time', i have to find out how long it took from the time the shipment arrived to the time the shipment was finished in minutes. I am using:

datediff(minute, time_shipment_arrived, time_shipment_finished). I get the correct output.

The problem i have is when in this 'operation time', the time passed midnight. i.e.
time_shipment_arrived = 1900-01-01 20:55:48.000
time_shipment_unloaded = 1900-01-01 23:55:48.000
time_shipment_logged = 1900-01-01 00:35:00.000
time_shipment_finished = 1900-01-01 03:35:00.000

Now, when i use above datediff, i get a wrong output.

How can i avoid this issue?

Please help.

Thanks in advance.

J