본문 바로가기

Windows 10/PowerShell

PowerShell : Date

반응형

- 날짜

# 현재 날짜
Get-Date

# 현재 날짜 (포맷)
Get-Date -Uformat "%Y-%m-%d %H:%M"

# 날짜 변경 (포맷)
Get-Date -Uformat "%Y-%m-%d %H:%M" -Year 1999 -Hour 19

# 일자로 계산
(Get-Date -Year 2010 -Month 12 -Day 31).DayOfYear
 
# 요일
(Get-Date -Year 2010 -Month 12 -Day 31).DayOfWeek

# 날짜 +- 계산 (AddDays / AddMonths / AddYears)
(Get-Date -Year 2011 -Month 12 -Day 31).adddays(1)

 

 

Get-Date (Microsoft.PowerShell.Utility)

The Get-Date cmdlet gets a DateTime object that represents the current date or a date that you specify. It can format the date and time in several Windows and UNIX formats. You can use Get-Date to generate a date or time character string, and then send the

docs.microsoft.com

 

반응형