Get-Date -Format Hidden Values

Using Get-Date -Format is beyond the scope of this blog. It’s covered very well in Microsoft’s official docs. I’m just going to discuss the single character shortcuts that aren’t well-documented.


Hurry! There is not a moment to lose.

© 2017 Microsoft; Nano Man 2: Server of the Realm

Quick Usage

Other Single Letter Formats

Figuring Out the Get-Date -Format Options

I’ve known for a while that Get-Date -Format 'O' gave me a super simple timestamp. I use it a lot for timestamping files names, like logs. Of course I have to replace the semicolons (Get-Date -Format 'O').Replace(':', '-'). Anyway, today, I was wondering what the other options were, so I took a trick out of password generating to quickly go through all of the upper and lowercase characters as options.

Since I know that ascii characters can be represented by numbers, and I know that A through Z is 65 to 90 and a through z is 97 to 122, I just decided to make a quick loop to spit out all the date options. See and try for yourself.

One-Liner in the CLI

Who wants to type all that in the CLI though? Here’s the one-liner with the respective output to save you the time:

Fixing Zulu

If you’re working with Zulu (aka GMT) time, the formatter doesn’t actually convert the timestamp to Zulu. You will have to do that yourself. Here’s without the fix and with the fix:


VertigoRay Administrator
Sorry! The Author has not filled his profile.

Leave a Reply

Your email address will not be published.