Page 1 of 1

To susbtract hours from DATETIME field

Posted: Mon Sep 21, 2015 7:52 am
by dbdecoy
Hi All

Can any one help with the command for subtracting hours from a date time field in uservariable activity stage.

For eg if I have a input value as 2015-09-21 10:00:00, need to subtract 2 hrs from it and need o/p like 2015-09-21 08:00:00

I think Iconv/oconv function will work.If any one knows please post the syntax for the same

Posted: Mon Sep 21, 2015 9:52 am
by vamsi_4a6
I think TimestampOffsetByComponents function should work

Posted: Mon Sep 21, 2015 9:53 am
by chulett
Only in a Parallel job, this is a Sequence job question.

Yes, you could use them in a custom routine but it would be a little tricky as the date and time portions would have to be handled separately. I.E. separate them and then subtract two hours (7200 seconds) from the time portion. If it rolls below zero (midnight) sutract one day from the date and adjust the time accordingly. Now, I may be misremembering the behaviour when you roll a time back past midnight, you'd need to test that yourself - you may just need the "delete one day" part in that case.

Ray, is your website not up? Moved? Gone? Was going to point them to your routines since you've already done all this but it seems to be down. :(

Posted: Mon Sep 21, 2015 5:32 pm
by ray.wurlod
Send me an email I'll send you a DSX. Website is under redevelopment in my copious free time (yeah.).