Time variables
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-06-15 05:27 PM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-06-15 06:17 PM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-06-15 06:25 PM
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)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-06-15 07:00 PM
Thanks Giles, that is exactly what I was after.
