Reputation: 15
So, I'm trying to calculate the retirement date using Get-Date in Powershell. I only want to see the date, no time but also with the day of the week. I've been trying to use methods, no formats. But even with using formats it does not seem to work.
(Get-Date -Day 12 -Month 12 -Year 2000).addYears(67).ToLongDateString()
December 12, 2067
I'd like to see something like Tuesday, December 12, 2067. This is the last part of my script, I've been trying to do this for a while but can't seem to figure it out.
Upvotes: 0
Views: 417
Reputation: 29012
Check out custom date and time format strings.
(Get-Date -Day 12 -Month 12 -Year 2000).addYears(67).ToString("dddd, MMMM d, yyyy")
The result is as you wanted:
Monday, December 12, 2067
Upvotes: 2