Posts tagged with "date function"

date function for bash commands

How to get date on bash/sh command?

# Datestamp e.g 2002-09-21_24h00m
DATE=`date +%Y-%m-%d_%Hh%Mm`

# Day of the week e.g. Monday
DATE=`date +%A`

# Day number of the week 1 to 7 where 1 represents Monday
DATE=`date +%u`

# Date of the Month e.g. 27
DATE=`date +%d`

# Month e.g January
DATE=`date +%B`

# Week Number e.g 37
DATE=`date +%V`