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
0
0 368
Discussion (3)0
Log in or sign up to continue

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?

..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.

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.