How to change the format of a column in format-table

HI All

I have created a script that only pulls the last-modified date/time in my folder see below:

Get-ChildItem $env:c:\folder | Measure-Object LastWriteTime -Maximum | Format-table -HideTableHeaders maximum

I then run the get-date -format “dd/MM/yyyy” to get the current system date.

I then need to be able to compare the two to see if a backup has been created in the location (it will be a zip file) and then our system will log a ticket if there is not one.

that is the story the question I have is how do I get the maximum value to change from datetime to just date?

I have ability to create variables from the results of powershell commands in my Connectwise Automate RMM so as long as I can get the results in the same format comparing shouldn’t be a problem.

Thanks

Ben

How about this

(Get-ChildItem $env:c:\folder| Sort LastWriteTime -Desc | Select -ExpandProperty LastWriteTime -First 1).ToShortDateString()

That works perfectly

Thank you so much.