date in Regional Language

Display date in a regional language with ChronoForms.

Overview

The CF {date:} tag only outputs dates in English, not supporting localized formatting.
Use PHP's strftime() function within the same view element, first setting the locale with setlocale() to define the regional language and timezone.

Answered
Connectivity v6
Pr Proximate 11 Mar, 2019
Hi together,
i am not sure aout that - it might not be a ChronoConnectivity Issue but how i am able to print out the {date:} informations in a local form. So our whole page is in German but the date Informations from Chrono are displayed in english.

What i've tried so far:
Added <?php setlocale(LC_ALL, 'de_DE'); date_default_timezone_set('Europe/Zurich'); ?> to the view.

The Date will be loaded like this atm: {date:D, d.M Y$(var:read_games.0.Game.date)} --> this gives us: Sat, 23.Mar 2019
But i will display the Date Informations in the local language (or at least in german like the whole page) what would mean: Sam, 23.Mär 2019

Thanks for your help
he healyhatman 11 Mar, 2019
Answer
You can't, at least not with {date:}. You'd need to do it in PHP.

http://php.net/manual/en/function.strftime.php
Pr Proximate 11 Mar, 2019
Solved by adding first:
<?php setlocale(LC_ALL, 'de_CH.UTF-8'); date_default_timezone_set('Europe/Zurich'); ?>

To define the localization and timezone (timezone is not really necessary but could be important in the future in this script)

and then for the content:
<?= strftime( '%A, %d.%B %Y', strtotime($this->get("read_games.0.Game.date", "0"))) ?>

Results in : Samstag, 23.März 2019

important notice: i had to put everything into the same "view" - element. I tried to "outsource" the first part into the Event (and load then the view containing the strftime) - that had not worked - it was still english.
This topic is locked and no more replies can be posted.