Converting Date From String

(imported topic written by Matt.Johnson)

So I am trying to create a property that will look at a date stamp that needs to be formatted as date and determine of if that date is > (Greater Than) current date.

I am pulling the string from:

(value “Deployment Timestamp” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Deployment 4” of registry as string)

Which returns a value like:20120409110538.000000-300

I don’t care about the time, just the date.

Can someone help me determine this relevance for a property?

Thanks!

Matt

(imported comment written by SystemAdmin)

I’m assuming the date in the string you have is April 9, 2012?

Basically you will have to convert it to the following format: “9 Apr 2012” and then cast it as a date. You can then compare it to the current date:

//Convert it to the correct format

q: (last 2 of first 10 of it & " " & first 3 of (last 2 of first 6 of it as integer as month as string) & " " & first 4 of it) of “20120409110538.000000-300”

A: 11 Apr 2012

T: 0.061 ms

I: singular string

//Cast it as a date

q: date ((last 2 of first 10 of it & " " & first 3 of (last 2 of first 6 of it as integer as month as string) & " " & first 4 of it) of “20120409110538.000000-300”)

A: Wed, 11 Apr 2012

T: 0.084 ms

I: singular date

//compare to current date

q: (date ((last 2 of first 10 of it & " " & first 3 of (last 2 of first 6 of it as integer as month as string) & " " & first 4 of it) of “20120409110538.000000-300”)) < current date

A: True

T: 0.093 ms

I: singular boolean