convert String to Date (without a leading zero)
hi,
i have string 7112010 (ie, 7th nov 2010), when try:
$str = "07112010"
[datetime]::parseexact($str, "dmmyyyy", $null)
works right away.
but when remove leading 'zero' string:
$str = "7112010"
[datetime]::parseexact($str, "dmmyyyy", $null)
it gives error saying: "string not recognized valid datetime."
i tried different formats, nothing working, can please?
sheesh! more ten years since y2k, , still having deal ambiguous date data, when non-ambiguous standard readily available: iso 8601 http://www.iso.org/iso/date_and_time_format.
Windows Server > Windows PowerShell
Comments
Post a Comment