converting datetime from wmiobject to datetime
<p>Trying to get the difference in days between to dates: Today's date. and a date/time from a wmiobject (this was taken from a post from the PendingReboot script from Hey, Scripting! blog):</p>

<pre><code>$Lastreboottime = Get-WmiObject win32_operatingsystem -ComputerName $Computer | 
select csname, @{LABEL='LastBootUpTime';EXPRESSION=$_.ConverttoDateTime($_.lastbootuptime)}} 
$Today = Get-Date -Format d
$DiffDays = $Today - $Lastreboottime 
</code></pre>

<p>The result of $Today is</p>

<pre><code>09/06/2016
</code></pre>

<p>and $Lastreboottime is </p>

<pre><code>05/05/2016 11:13:21 
</code></pre>

<p>So I want to get rid of the time but not sure how to do this.</p>

<p>Secondly, I get this error if I were to run the script, though I guess this may go away if I am able to extract the date only in $Lastreboot</p>

<pre><code>Cannot convert the "@{csname=JDWTAWEB1; LastBootUpTime=05/05/2016 11:13:21}" value of type "Selected.System.Management.ManagementObject" to type "System.DateTime".
</code></pre>

<p>Any ideas?</p>