[datetime]$date = Get-Date
$date.ToString('yyyy-MM-dd')
See the section on working with dates and times for more on this topic
PS C:\> [datetime]$date = Get-Date >> $date.ToString('yyyy-MM-dd') 2019-03-28
[datetime]$date = Get-Date
$date.ToString('yyyy-MM-dd')
DetailsPS C:\> [datetime]$date = Get-Date >> $date.ToString('yyyy-MM-dd') 2019-03-28