$date.ToString("yyyy-MM-dd HH:mm:ss.fff")
Format a DateTime value in the SQL format
PS C:\> $Date = Get-Date >> $date.ToString("yyyy-MM-dd HH:mm:ss.fff") 2019-03-28 11:05:58.440
$date.ToString("yyyy-MM-dd HH:mm:ss.fff")
DetailsPS C:\> $Date = Get-Date >> $date.ToString("yyyy-MM-dd HH:mm:ss.fff") 2019-03-28 11:05:58.440