Page 1 of 1

adding 3 hours to time stamp

Posted: Thu Jan 30, 2014 5:13 am
by marpadga18
I have source data as Nvarchar

Source.
12/01/2013 15:13:17 -0800
12/09/2013 13:41:12 -0800
01/07/2014 07:09:40 -0800

I need to add 3 hours for only hours part.
12/01/2013 18:13:17
12/09/2013 16:41:12
01/07/2014 10:09:40

I tried to substing[1,19) then convert to string to timestamp then it is working but got stuck how to addd 3 hour to that time part any ideas?

Posted: Thu Jan 30, 2014 8:33 am
by chulett
After converting to timestamp, use TimestampOffsetByComponents() and add three hours. That or TimestampOffsetBySeconds() and add 10800 seconds.

Posted: Thu Jan 30, 2014 8:42 am
by marpadga18
yes I did that

TimestampFromSecondsSince(10800,StringToTimestamp(i.column,"%(m,s) %(d,s) %yyyy %(H,s):%n:%s"))

Thanks for the reply

Posted: Thu Jan 30, 2014 10:25 am
by chulett
That works too. :wink: