What's the shortest way to get the current year?
Is there a shorter way than
$P($ZD($H),"/",3)
?
Comments
Hi.
Try +$ZD($H,3)...
Regards,
Matjaž
$p($zd($h,3),"-",1)
The only reason I add this alternative is the $zd($h,3) returns the date in ODBC format and every ObjectScript developer is familiar with $zd($h,3) and the %TimeStamp data type uses this ODBC format
Nigel
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