How to Get the Date in Bash
today=$(date +%Y-%m-%d)
echo $today
When you run the above command, the current date is displayed in YYYY-MM-DD format.
How to Get the Date in PowerShell
$var = Get-Date
$DATE = "" + $var.year + $var.month + $var.day + $var.hour + $var.minute + $var.second
$today = "" + $var.year + '-' + $var.month + '-' + $var.day
echo $var
echo $DATE
echo $today
When you run the above PowerShell script, the current date is displayed in each format.
Using these methods, you can easily get the current date in Bash and PowerShell.