How to Print the Current Date and Time in Windows Command Line
Need to quickly see the current date and time in your Windows terminal? This simple how-to guide shows you exactly which commands to use in both Command Prompt and PowerShell. It is useful for beginners, scripting, logging, and everyday tasks.
Step 1: Open the Terminal
- Press Windows + R, type
cmd, and press Enter for Command Prompt. - Or search for PowerShell in the Start menu.
Step 2: Show the Date and Time (Command Prompt)
Print only the date:
date /t
Print only the time:
time /t
Print both together:
echo %date% %time%
This is helpful when you want a quick timestamp in a script or log file.
Step 3: Show the Date and Time (PowerShell)
Display the current date and time:
Get-Date
Format the output:
Get-Date -Format "yyyy-MM-dd HH:mm:ss"
This creates a clean, readable timestamp like 2026-01-19 14:45:30.
💡 Tip
You can redirect these commands into a file to create simple logs.
Learning these small commands improves productivity and makes working in the Windows terminal easier and more efficient for daily tasks.
Comments