The VARCHAR_FORMAT function returns a string representation of a timestamp that has been formatted according to a specified character template

Example :

Select Varchar_Format(Current_Date, 'YYYYMM') From Sysibm/Sysdummy1

This query returns 201806