I have this code

SET @START_DT = "2019-08-05T06:07:08.1230000-06:00"

Which output format is:

  1. august

I would like to add the year to it so the output would be

  1. august 2019

I tried to add diferent format pattern from https://ampscript.guide/formatdate/

Like "DD MMMM YYYY" it works, but I don't like the "0" infront


05 august 2019

I like the format Pattern "M" with the year in the end

| improve this question | | | | |
  • 2
    You have to do the following FORMATDATE(@START_DT,"D. MMMM YYYY","","da-DK") – Johannes Schapdick Aug 6 '19 at 11:52
  • You are great Johannes! That worked. Thank you very much! – Martin Ho Aug 6 '19 at 11:59

To provide it as answer (even though i might not be worth it):

You have to do the following FORMATDATE(@START_DT,"D. MMMM YYYY","","da-DK")

You can set delimeters like you want in these format strings and also whitespaces and stuff like it.

It could be FORMATDATE(@START_DT,"D/ MMMM /YYYY","","da-DK") when you would like to have

5/ august /2019


FORMATDATE(@START_DT,"D - MMM - YYYY","","da-DK") when you would like to have

5 - aug - 2019

Just try to experiment with it on cloudpages and you can easily see what you want. (Just make sure to insert those ampscript likes inside ampscript codeblocks or inline ampscript and inside an HTML area [not text])

| improve this answer | | | | |
  • Ah very useful. I didn't know what. Thanks! – Martin Ho Aug 6 '19 at 12:29
  • From: “I don’t know if this is good enough for an answer” to +6 and accepted in 6 hours. Well done 👍🏼 – Lukas Lunow Aug 6 '19 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.