DateTime in constant

Hi! How to write a DateTime constant in C/AL code? I tried like this: dt := 17051997234500000DT; {dt - variable (DateTime), May 17, 1997, 23:45:00.000} … but it returns an error :frowning: Thank you.

From C/SIDE Reference:


Comments There is only one constant available when you use this data type: undefined datetime. DateTime := 0DT

So you could use that workaround:dt := CREATEDATETIME(17051997D, 2345T); Regards, Jörg

Thanks a lot! It works!

Remember that DateTime uses UTC times, unlike the Time type!