twig: Simple format date and time

Task: Display formatted time from http://worldtimeapi.org/api/timezone/Europe/Berlin.

Local stored JSON: https://api.json-content-importer.com/extra/json/worldtimeapi-Berlin.json

If you want to set the language (e. g. name of weekdays and month) and the timezone: see here


See how this works:


  • URL: see above
  • twig-template:
currentDateTime: {{datetime }}<br>
formatted currentDateTime: {{datetime| date("d.m.Y H:i") }}

In Action:

currentDateTime: 2024-10-07T07:08:15.310399+02:00
formatted currentDateTime: 07.10.2024 05:08