When taking a date / time string from an object:
The format of the input is a string and get-date doesn't seem to be able to convert it to
to a System.DateTime.
I want to compare that value to 30 days ago so get-date((get-date).adddays(-30))
When I try the following, it seems to work and import it:
(get-date -UFormat "%d/%m/%Y %T"("30/06/2010 00:00:00"))
If I add the following:
'[datetime]'(get-date -UFormat "%d/%m/%Y %T"("30/06/2010 00:00:00"))
It can't convert it.
Without the datetime component, when I try a greater than test it uses just the date
part so:
$Test = "10/06/2009 00:00:00"
If($Test -gt (get-date -UFormat "%d/%m/%Y %T"("05/06/2010 00:00:00")))
{
$Tested = "Yes"
}
Else
{
$Tested = "No"
}
$tested
Results in a Yes desite being earlier.
So in the script it returns any of the entries where the date is greater
than 05 and ignore the year, month and time.
Any help with this would be greatly appreciated.
Thanks,