Reema
Reema

Reputation: 969

Get DayOFYear in XXX format in Powershell

I am trying to get the day of the year in XXX format. Like on 55th day it should show 055 and on 110th day it should just show 110. (Get-Date).DayOfYear gives just 55, but the string format that I need to work with has to have a format of XXX

Upvotes: 0

Views: 1012

Answers (1)

Tim Francis
Tim Francis

Reputation: 96

Try This: "{0:D3}" -f (Get-Date).DayofYear

more info here

Upvotes: 6

Related Questions