datetime default output format

if i type Get-Date i get the following output (german):

Dienstag, 13. März 2018 12:34:47
IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     DateTime                                 System.ValueType

It is a DateTime object.

I would like to change the default output of Get-Date to 13.03.2018 12:34:47 but keep the Type as DateTime (so i cant you ToString()??)

Can i do this without changing the regional settings in Windows?
Can you suggest how the get to this?


Could you not use

Get-Date -Format “ddMMyyyy HH:MM:ss”

It is changed to string object then.

Thanks is there no other way than creating a psx1ml file?

My goal is to have date in this format and to make it sortable in Powershell Universal Dashboard (Out-UDGridData)

It’s determined by your operating system settings. So no, you can’t modify it except by making a String.

You can format the date on the client-side with UD, if that is helpful. I added some documentation to the Gitbook about it:

Thanks Adam, this worked well.