How to trim YEAR, convert and replace STRING in export file

I want to export %year% in a format that will be used in HTML later. My songs have the following format "2020-09-21T07:00:00Z" and sometimes "2020-09-21".

I want to transform it into the Brazilian format: "DD de MM de YYYY" and also replace MM with the Portuguese word equivalent. For example, you have "February 24, 2020", and in Brazil it would be "24 de Fevereiro de 2020".

1º how to achieve the desired year format and how to replace accordingly in the export file? Can it be done with 12 ifs? I started with something like:

$if( "MM" from "DD de MM de YYYY" = 01 , $replace(%year%,01,Janeiro)], do nothing )
$if( "MM" from "DD de MM de YYYY" = 02 , $replace(%year%,02,Fevereiro)], do nothing )
$if( "MM" from "DD de MM de YYYY" = 03 , $replace(%year%,03,Março)], do nothing )

I appreciate any help very much.

To get that into the

$regexp(%year%,'(\d+)\-(\d+)\-(\d+)T.*','$3 de $2 de $1')

Hi again, it works for the first part for the problem. Thank you for that. Now I'm trying to reutilize the variable "$2" and replace accordingly to my needs, but it seems not to work with $replace($2,from,to) or $puts($2,y). What am I doing wrong?

Yep, that does not work right, try something really longish:
$regexp(%year%,'(\d+)\-(\d+)\-(\d+)T.*','$3 de') $replace($regexp(%year%,'(\d+)\-(\d+)\-(\d+)T.*','$2'),09,Septembre) de $regexp(%year%,'(\d+)\-(\d+)\-(\d+)T.*','$1')

You have to add in the $replace() statement the list of number/month pairs

1 Like

Worked perfectly. Thank you!