diff --git a/public/ConvertTo-DbaDataTable.ps1 b/public/ConvertTo-DbaDataTable.ps1 index bf2adf3ff5..c0bbecd772 100644 --- a/public/ConvertTo-DbaDataTable.ps1 +++ b/public/ConvertTo-DbaDataTable.ps1 @@ -166,6 +166,11 @@ function ConvertTo-DbaDataTable { } } $specialType = 'Size' + } elseif ($type -eq 'Dataplat.Dbatools.Utility.DbaDateTime') { + $special = $true + $value = [System.DateTime]$value.DateTime + $type = 'System.DateTime' + $specialType = 'DateTime' } elseif (-not ($type -in $types)) { # All types which are not found in the array will be converted into strings. # In this way we don't ignore it completely and it will be clear in the end why it looks as it does. @@ -217,6 +222,9 @@ function ConvertTo-DbaDataTable { $Value.$TimeSpanType } } + 'DateTime' { + return [System.DateTime]$Value.DateTime + } } }