$ printf '%(%F)T\n' 2016-08-17
$ printf -v now '%(%T)T' $ echo "$now" 12:42:47
Using printf -v foo '%(...)T' is identical to foo=$(date +'...') and saves a fork for the call to the external program date.
printf -v foo '%(...)T'
foo=$(date +'...')
date
Read Articlehttps://develop.horje.com/learn/1434/reference