Summary: Use the –format option in Get-Date to change the output.
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?
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’