Timestamp expression


(Ra Li) #1

Hi, I’m trying to set an expression to pull UTC time instead of my current time. What is the best way to achieve that?

Thanks,


(Victoria Tuktarova) #2

Hello,

I would suggest using dateAdd expression. The syntax is following “datetype dateAdd(datetype srcDate, integer srcValue, string fieldName)”.
Please, check the screenshot with an example.

dateAdd

Hope my answer is sufficient.

Regards,
Victoria


(Ra Li) #3

Hi Victoria- Thanks for the response. Does this account for a Daylight saving time changes throughout the year?

I assume this uses local time -/+ x hours, with daylight saving, the difference might change.

Thanks,


(Victoria Tuktarova) #4

Hello,

Unfortunately, this expression does not account time change. Hence, manual change would be needed.

Besides, if it fits your use case, you can set UTC time by doing the following: add –Duser.timezone=UCT to Run Configurations > Runtimes > VM arguments in the Run Configurations properties screen from within your plan. This might be useful if the purpose is to change timezone to match DB, for instance.

In general, a lot of processes are related to system time. Import to database, scheduled tasks etc. If time is not local then errors might appear, hence any manual operations with time are not recommended and should be done very carefully.

Can you provide us a use case? Maybe I will manage to find other workaround for you.

Regards,
Victoria