I saw Frink's post on formatting Date/Time and thought I'd throw this out. The -f format operator calls the .NET Format method on the System.String class. I know as Admins/non-coders seeing .NET leads to "but I'm not a programmer!". It can be helpful to dig through some of the documentation though.
In this case the solution to Frink's issue can be simplified to:
(or to quickly check interactively
Additional information can be found on Composite Formatting at and various links off of there.
In this case the solution to Frink's issue can be simplified to:
Code:
$datDateTimeFormatted = "{0:dd}/{0:MM}/{0:yyyy} {0:hh}:{0:mm}:{0:ss}" -f (Get-Date)
Code:
"{0:dd}/{0:MM}/{0:yyyy}" -f (Get-Date)
Additional information can be found on Composite Formatting at and various links off of there.