cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CAI date format -deployment considering regions

roy_pappachan2
Participant
0 Kudos

Hi Expert,

I have a case that my chatbot would be using by all over the world customers and I have chat responses with dates. Currently there is no user profile kind of flexibility in chatbot to show message as region specific dynamic format.

So I was thinking to display date format in 27-Feb-2021 format so that any region users can understand this format.

I have tried format "{{formatDate memory.nonformatdate1 'DD-Mon-YYYY'}}" but getting response as "27-2ndn-2021".

Is there any way can we get this displayed with month name format in CAI ( with CAI's script ) without using an extra date conversion API?

Don't you think , will it be a common requirement from all customers who ever using the chatbot?

Thanks,

Roy

Accepted Solutions (1)

Accepted Solutions (1)

JonasB
Contributor

Hi Roy,

you would like to format your date as "27-Feb-2021". For the three letter month, you need to use the token "MMM", so the full example should be:

{{formatDate memory.nonformatdate1 "DD-MMM-YYYY"}}

See https://momentjs.com/docs/#/displaying/format/ for all tokens.

Regards
Jonas

roy_pappachan2
Participant
0 Kudos

My mistake...Thanks Jonas.

Answers (1)

Answers (1)

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

What about:

{{formatDate nlp.timestamp "DD-Mon-YYYY"}}

The function interprets Mo as which month (1st to 12th) is the month, and the n is just literal text 😀

See https://docs.celigo.com/hc/en-us/articles/360045564992-Handlebar-expressions-for-date-and-time-forma... for how to use date codes

roy_pappachan2
Participant
0 Kudos

Thanks Daniel.