Skip to main content
gautams4173
September 25, 2023
Question

Date Formatting

  • September 25, 2023
  • 7 replies
  • 0 views

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
September 25, 2023

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

gautams4173
September 25, 2023

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

ajk0002
September 25, 2023

Hi 

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

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

September 25, 2023

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
September 25, 2023

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"
  )
)