Question
· Jul 29, 2021

What's the shortest way to get the current year?

Is there a shorter way than

$P($ZD($H),"/",3)

?

Product version: Caché 2018.1
Discussion (3)2
Log in or sign up to continue

The equivalent for Dat/Times is $zdt($h,3) which will give you YYYY-MM-DD HH:MM:SS

If you want greater precision you can use

$zdt($now(),3,,6)

If $now() is 65954,68889.600788 then

$zdt($now(),3,,6) returns 2021-07-29 19:08:09.600788

This can be useful where you have data flowing in where there are many records per second and you want to be more accurate when assigning a Date/Time to the data.

The 6 in $zdt($now(),3,,6) indicates 6 digits in the Milliseconds

Nigel

Nigel