Format Date

Options

I am trying to format a date this way: March 3, 2022 - unless I missed it, I see how to format in the MM-dd-yyyy format and that works great, but I would like to spell the month out and use the comma as noted. I looked online and didn't see instructions specific to that - anyone figure this out and willing to share?

Comments

  • Reuben Schmitz:

    I am trying to format a date this way: March 3, 2022 - unless I missed it, I see how to format in the MM-dd-yyyy format and that works great, but I would like to spell the month out and use the comma as noted. I looked online and didn't see instructions specific to that - anyone figure this out and willing to share?

    You can get the format the date the way you described by using formatDateTime(<yourDate>, 'MMMM dd, yyyy')

    Or if you want an abbreviated date you can use MMM.

  • I will give it another try - last time, I tried the MMM dd, yyyy format, but got an error that said it wasn't a proper formula - but perhaps there was something else not correct. Thanks for the input and I will let you know.

  • Austen Brown
    Austen Brown Community All-Star
    Ninth Anniversary Kudos 5 Name Dropper Participant

    Hi @Reuben Schmitz - I was able to successfully replicate what Matt suggested. Make sure you are listing the ‘MMM dd, yyyy’ within single quotes in the expression.

  • Glen Hutson
    Glen Hutson Blackbaud Employee
    Tenth Anniversary Kudos 3 Name Dropper Participant

    You may have already looked at this, but you can use the “Convert Time Zone” action, even if you're not actually converting from one TimeZone to another (you set both the same). That has formatting options without needing to keep track of the exact nuances of the format strings.

  • Hi, you may have already figured this out, but this is the full expression I use for my date: formatDateTime(items('Apply_to_each')['date'], 'MMMM d, yyyy'). I just copy and paste the entire thing, as is into the expression.

  • I tried it again and your solution worked - no error this time. Thanks again for the input.

Categories