Format date output of query as yyyy-mm-dd

We are recycling code We found here on the forum to get the “installed date” of the last patch applied on Windows servers and store it as a custom property of the server object. The code below works perfecly. I want to express the output as yyyy-mm-dd rather than the default “Wed, 11 Jan 2023 10:44:15 -0500”

I am awarte of the ability to express a date in different ways using the format command as outlined in this post by Jason Walker:
https://forum.bigfix.com/t/tip-format-and-time-date/33177

or something like:
(year of it as string & “-” & month of it as two digits & “-” & day_of_month of it as two digits) of current date

I just can’t figure out how to appky it to the code below.

Code:
maximum of (“1 Jan 1601 00:00:00 -0000” as time + it * second) of ((item 0 of it * 4294967296 + item 1 of it) / 10000000) of (values “InstallTimeHigh” of it as integer, values “InstallTimeLow” of it as integer) of keys whose (name of it starts with “Package_”) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages” of native registry

Thoughts?

Cheers,
E

Using your relevance, this would be an approach I would use to cast it as a custom date format.

Q: ((year of it as string & "-" & (month of it as two digits) & "-" & (day_of_month of it as two digits)) of date ("GMT" as time zone) of it) of (maximum of ("1 Jan 1601 00:00:00 -0000" as time + it * second) of ((item 0 of it * 4294967296 + item 1 of it) / 10000000) of (values "InstallTimeHigh" of it as integer, values "InstallTimeLow" of it as integer) of keys whose (name of it starts with "Package_") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages" of native registry)
A: 2023-02-03
T: 105.360 ms
I: singular string

(edited to correct date format)

4 Likes

Thanks for the help. Problem solved.

Cheers,
E