Skip to main content
gautams4173
Known Participant
Sep 25, 2023 8:38 AM UTC
Question

Date Formatting

Hi,

I am receiving date in the format like : 25SEP 

I want to format it in this format : 25th September 

Is there a way to do it ? 

7 replies

anmolv0003
Participating Frequently
Sep 25, 2023 8:41 AM UTC

text(todate(now()), "dd mmmm yyyy")

Anmol
gautams4173
Known Participant
Sep 25, 2023 8:41 AM UTC

wont work ... I can receive yesterdays date also ... 24SEP

ajk0002
Inspiring
Sep 25, 2023 8:48 AM UTC

Hi 

Replace now() in above code snippet with received dates.

text(todate("Received Date"), "dd mmmm yyyy") 

Participating Frequently
Sep 25, 2023 8:59 AM UTC

Convert the value you to date and pass it to text function like this

text(date(0,9,25),"ddd mmmm") 
, as you don't want year just mentioned 0 in place of year  when executing above you will get output as 25th September

mathieud0001
Genius
Sep 25, 2023 11:11 AM UTC

a!localVariables(
  local!dateTextValue: "SEP25",
  local!months: {
    "JAN",
    "FEB",
    "MAR",
    "APR",
    "MAY",
    "JUN",
    "JUL",
    "AUG",
    "SEP",
    "OCT",
    "NOV",
    "DEC"
  },
  local!monthKey: left(local!dateTextValue, 3),
  local!month: wherecontains(local!monthKey, local!months),
  local!day: mid(
    local!dateTextValue,
    4,
    len(local!dateTextValue) - 3
  ),
  text(
    date(year(now()), local!month, local!day),
    "mmmm ddd"
  )
)