Written by

Question Michael Wood · Apr 16, 2021

How do I return ..CurrentDateTime() in format YYYY-MM-DDTHH:MM:SS+?

How to I use ..CurrentDateTime() so it returns in format YYYY-MM-DDTHH:MM:SS+ and in eastern time?  Need code to be in DTL, not in ObjectScript.

Product version: IRIS 2020.2

Comments

Vic Sun · Apr 16, 2021

Hello Michael,

What is your current CurrentDateTime call and are you familiar with the syntax for setting the format? What is missing or needs to change in your current result?

0
Michael Wood  Apr 16, 2021 to Vic Sun

..CurrentDateTime("%K(-4)%q") works to produce the current date/time in ET. However, I'm not sure if this intersystems function allows for variables ..CurrentDateTime("%K(tDstOffSet)%q"). What is returned is the UTC time which is the default for this %K format.

0
Vic Sun  Apr 20, 2021 to Michael Wood

Hello Michael,

I tested this in terminal calling ##class(Ens.Util.FunctionSet).CurrentDateTime(), and I can't see a reason why you couldn't use a variable in this function. You'd need to concatenate your variable into the time format string, ex:
..CurrentDateTime("%K("_tDstOffSet_")%q")

Let me know if that works for you.

0