Alfonso Crisci 7 Years Ago Thanks Jan, very useful post ! Please sign in to reply. Reply as... Cancel
Alessandro Candini 7 Years Ago Thank you!And if I would like to print a date differently based on the portal language setup, let's say 12/23/2016 for en_US and 23/12/2016 for it_IT, how to manage this? I've some problems in doing that, expecially regarding the 4 digits representation of the year... Please sign in to reply. Reply as... Cancel Jan Eerdekens Alessandro Candini 7 Years Ago Hi Alessandro,The screenshot in the post basically shows a variant of the scenario you want. In it you can see that the dates in the 2 asset publishers are different based on the configured locale and datetime_format settings.In your case you would just need to figure out the correct datetime_format to use. For an American date this would be MM/dd/yyyy and for a European date it would be dd/MM/yyyy.If you want to easily test or experiment with formats you can use this online tool: http://www.sdfonlinetester.info/ Please sign in to reply. Reply as... Cancel
Jan Eerdekens Alessandro Candini 7 Years Ago Hi Alessandro,The screenshot in the post basically shows a variant of the scenario you want. In it you can see that the dates in the 2 asset publishers are different based on the configured locale and datetime_format settings.In your case you would just need to figure out the correct datetime_format to use. For an American date this would be MM/dd/yyyy and for a European date it would be dd/MM/yyyy.If you want to easily test or experiment with formats you can use this online tool: http://www.sdfonlinetester.info/ Please sign in to reply. Reply as... Cancel
Alessandro Candini 7 Years Ago Thank you Jan, I were able to print date with different locales.The problem is that the default american date is not MM/dd/yyyy but MM/dd/yy (only two digits for the year). And the italian date is correctly represented as dd/MM/yy but also in this case only 2 digits for the year.I cannot find any snippet to have instead MM/dd/yyyy and dd/MM/yyyy Please sign in to reply. Reply as... Cancel Jan Eerdekens Alessandro Candini 7 Years Ago I can change the value of the datetime_format to MM/dd/yyyy and it works fine for me and prints the date correctly. Example snippet: https://gist.github.com/planetsizebrain/a9dc41e72f3fba2a1bd84caef0741ac5 Please sign in to reply. Reply as... Cancel
Jan Eerdekens Alessandro Candini 7 Years Ago I can change the value of the datetime_format to MM/dd/yyyy and it works fine for me and prints the date correctly. Example snippet: https://gist.github.com/planetsizebrain/a9dc41e72f3fba2a1bd84caef0741ac5 Please sign in to reply. Reply as... Cancel
Alessandro Candini 7 Years Ago Continuing the discussion on the Github link above... Please sign in to reply. Reply as... Cancel Jan Eerdekens Alessandro Candini 7 Years Ago In that case you'll need to set the datetime_format conditionally based on the current portal locale. I've added an example to the Github link. Please sign in to reply. Reply as... Cancel
Jan Eerdekens Alessandro Candini 7 Years Ago In that case you'll need to set the datetime_format conditionally based on the current portal locale. I've added an example to the Github link. Please sign in to reply. Reply as... Cancel