In Bash:

get year-month-day from date

DATE=`date +%Y-%m-%d`
get year-month-day hour:minute:second from date

DATE=`date '+%Y-%m-%d %H:%M:%S'`