I want to get sysdate -1 and sysdate -2 in variable and echo it. I am using below query which gives todays date as output.
#! /bin/bash tm=$(date +%Y%d%m) echo $tm
How to get yesterday and day before yesterdays date?
How do you get yesterdays' date using JavaScript? We use the setDate() method on yesterday , passing as parameter the current day minus one. Even if it's day 1 of the month, JavaScript is logical enough and it will point to the last day of the previous month.
Here is another one way,
For yesterday,
date -d '-1 day' '+%Y%d%m'
For day before yesterday,
date -d '-2 day' '+%Y%d%m'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With