question about date format

Hi

I have a small question about date format
I use Get-Date -Format “yyyy-MM-dd” which gives me 2020-04-08 however I would like to see 2020-apr-08
how do I achieve this?
the same for this one
(get-date).AddDays(-1).ToString(“yyyy-MM-dd”)

thanks for the pointers

 

never mind sorted out in the mean time

The format argument in your examples is called a format string specifier. Here is a link to the documentation for custom date/times: https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

 

this may do what you need. I did a “help get-date -full” and found the info.

Get-Date -UFormat “%Y-%b-%d”

2020-Apr-08

Why so complicated? :wink:

Get-Date -Format ‘yyyy-MMM-dd’

and BTW: if you want to have the full name of the month … guess what …

Get-Date -Format ‘yyyy-MMMM-dd’

:wink:

thanks everyone for your input
@olaf I figured that part out as well as mentioned on my original question I found the solution shortly after I posted my question

 

Best regards

Paul