Sunday, 17 November 2013

How to Print Previous date in Bash


To print previous day date and time use the following script

#!/bin/bash
EPOCH=`date +%s`
YESTERDAY=$(($EPOCH - 86400))
echo `date -d @$YESTERDAY`