How to translate built-in FormatDatetime function result to Portuguese ?

How to translate built-in FormatDatetime function result to Portuguese ?

  

Hi folks.

I'm looking for a way to translate the month names and day of week names returned by FormatDateTime built-in function. 

I need that on mobile and web applications.

Can anyone help me ?

Thanks in advance.

Luciano Guimaraes

Hi Luciano,

You will have to write your own FormatDateTime...

Cheers,

José

Oh no! seriously ? I think use moment.js is an alternative to...

Thanks again Jose.

Luciano

Hi Luciano,

You can do it throug Switch case translate the month names and day of week names returned by FormatDateTime built-in function and assign it to Portuguese Month and day of week name.

Thanks,

-HM-



Hi Hitesh.

Did you mean it by doing a string replace on the function result ?

It's an ideia... Easier than build my own function.

Cheers.

Luciano

Solution

Hi Luciano,

You will still need to built your own function to do that...

And it's not actually a good idea to parse a text of a date when you can have:

  • Months in a Static entity with an attribute with the number of the month
  • Days of week in a Static entity with an attribute with the number of the day of week
  • Function to get the Year, get the number of the Month, get the number of the day of the week and so on... and use the static entities to built your string.

Much more efficient and much less error prone.

Cheers,

José

Solution

Hi Jose.

Clean and elegant.

Thank you all guys for the fast answers.

Seeya