Written by

Question Permo Jacobs · Jan 17, 2018

substring only the year or month from current date

how do you substring only the year or month from current date

Comments

Aman Rana · Jan 17, 2018

USER>Write $Piece($ZDate($Horolog,9)," ")
January
USER>Write $Piece($ZDate($Horolog,3),"-")
2018

0
Eduard Lebedyuk · Jan 17, 2018

You can use DATEPART function:

w $SYSTEM.SQL.DATEPART("year", $h)
>2018
w $SYSTEM.SQL.DATEPART("month", $h)
>1

The advantage of this approach is more readable code.

0