Bash PowerShell Date How to Get

Getting the Date in Bash/PowerShell

This article explains how to get the date in Bash and PowerShell.

Shou Arisaka
1 min read
Oct 31, 2025

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.

Share this article

Shou Arisaka Oct 31, 2025

๐Ÿ”— Copy Links