Forums

date in Regional Language

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
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
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.

VPS & Email Hosting 20% discount
hostinger