Reputation: 1203
More out of curiosity as its working fine for me (I'm just beginning with Powershell) but I'm using below to obtain a short date for use in file names:
$shortdate = (get-date).toshortdatestring().replace("/",".")
Is there a built in functionality for this or is this the correct way to accomplish this?
Upvotes: 3
Views: 7629
Reputation: 29450
You can use the -Format
argument of get-date
:
get-date -format "MM.dd.yyyy"
11.20.2012
Upvotes: 6