Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PowerShell get weekday name from a date

Tags:

powershell

Using powershell I want to get the week day name (Friday) from a date. Been googling and cant find this one. It so I can do an IF statement to do something if the date is a Friday.

Can anyone help?

like image 599
Silentbob Avatar asked Jan 14 '16 10:01

Silentbob


1 Answers

Use Get-Date to produce a DateTime object, then call its DayOfWeek method. For example:

(get-date 01/01/2016).DayOfWeek
like image 169
ConanW Avatar answered Oct 13 '22 20:10

ConanW