get current time and format it using awk

get seconds of current time in seconds since 1970-01-01 00:00:00

awk 'BEGIN{ print systime() }'

format the current date using strftime() functions

awk 'BEGIN{print strftime("%d/%m/%Y %H:%M:%S", systime())}'

get today date less 1 day ( yesterday day )

awk 'BEGIN{ print strftime( "%Y%m%d", systime() )-1 }'

get only year and month of current data

awk 'BEGIN{ print strftime("%Y%m", systime()) }'

get only year and month of a date string

awk '{ print substr( $0,1,6 ) }' <<<'20180530'