cancel
Showing results for 
Search instead for 
Did you mean: 

Time variables

Graeme__Tacon
Level 6
I need to manipulate a time variable (subtract a number of minutes from it), which would seem quite easy. What ever I try though, the number of seconds is dropped. i.e. Use a calculation stage to 'copy' the time variable to a string: 10:11:12 becomes 10:11 Using Right(Time,2) gives '11' and not '12' Has anyone else had this issue and can suggest a way around it ?
3 REPLIES 3

You can subtract a number of minutes from a DateTime simply by subtracting a TimeSpan E.g: [theDateTime] - (MakeTimeSpan(0, 0, 2, 0)) Please do not use concoctions using FormatDateTime, or Left, Right, etc. These functions are designed for string processing, and will almost certainly result in a bug when used in the context of Dates and Times

Since the OP was about Time, rather than DateTime I thought it only fitting to provide another example: MakeTime(12, 30, 04) - MakeTimeSpan(0,0,2,0) Result: 12:28:04(time)

Thanks Giles, that is exactly what I was after.