Get-Date Formatting for Tomorrow
I had an almost identical question as posted here. I’m glad someone had the answer.
I was trying to get the tomorrow date in this exact format mm/dd/yyyy
; however, Powershell kept returning mm-dd-yyyy
; and if I used the Unix format of -UFormat %m/%d/%Y
, then the result was a string and I couldn’t use .AddDays(1)
on the Get-Date cmdlet.
Here was the solution:
This is running the Get-Date cmdlet to return a date (-Date
)…
Which date? Today’s date +1 ($(Get-Date).AddDays(1)
),
then format it the way I want: (-UFormat "%m/%d/%Y"
)