Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

parseexact

$
0
0

Hi,

I would like converting a registry value to datetime.

In the registry, the value is: 08/20/2019 13:18:50

With get-date, I get: 20 août 2019 15:30:57

$test = '08/20/2019 13:18:50'
[datetime]::parseexact($test, 'yyyy-MM-dd HH:mm:SS', $null)
 

And then I get 

Exception lors de l'appel de « ParseExact » avec « 3 » argument(s) : « La chaîne n'a pas été reconnue en tant que DateTime valide. »
Au caractère Ligne:2 : 1
+ [datetime]::parseexact($test, 'yyyy-MM-dd HH:mm:SS', $null)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException

Invalid datetime...

I need comparing the date time from the registry with the current date time and see if its bigger than 30 days.

Any idea?



Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>