Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Get the time and date as a string of numbers by using PowerShell

$
0
0

Summary: Use the –format option in Get-Date to change the output.

Hey, Scripting Guy! Question I’d like to build some log files and have the date and time as part of the name. Is there a way to show the date and time in a format where it’s all numbers?

Hey, Scripting Guy! Answer Absolutely! Just use the –format option with Get-Date and supply a format for the output. To see the format as month, day, year, hour, minutes, and seconds, use this example:

Get-Date –format ‘MM_dd_yyyy-HH_MM_ss’

The Doctor


Viewing all articles
Browse latest Browse all 3333

Trending Articles