How can I show a date in Urdu? I am working on printing dates in more than a language. With Drupal 7, I used the following code.
&lt;span class=&quot;arabic-date&quot;&gt;
 &lt;?php
   $arrayurdudays = array('', '', '', '', '', '', '', '');
   print format_date(time(), 'custom', ' l , d F , Y', null, 'ur');
 ?&gt;
&lt;/span&gt;  

With Drupal 8 and Twig, I tried more than one way and it didn't work for me.
I downloaded the Configuration Translation module, but it didn't work in my case; I read there is a way to print it inside a file (.theme), but I didn't understand the method well. I need it inside the header file.
In a Twig template, you can use the format_date() filter. For example, in the node template, the following code could be used to show (using a custom format) when a node has been created. (The following code is a simplified version of the code used from the Unami theme used with the Unami Demo installation profile, in node.html.twig.)
{% set created_date = node.getCreatedTime|format_date('custom', 'l, d F, Y', null, 'ur') %}

{% if display_submitted %}
  &lt;footer class=&quot;node__meta&quot;&gt;
    &lt;div{{ author_attributes.addClass('node__submitted') }}&gt;
      {% trans %}&lt;span class=&quot;by-author&quot;&gt;by {{ author_name }}&lt;/span&gt; {{ created_date }}{% endtrans %}
    &lt;/div&gt;
  &lt;/footer&gt;
{% endif %}

I would rather avoid passing a language code to format_date() to let the filter use the language set for the page. Setting the language code would make the template file always use that, even if the page is using a different language code.
{% set created_date = node.getCreatedTime|format_date('custom', 'l, d F, Y') %}

{% if display_submitted %}
  &lt;footer class=&quot;node__meta&quot;&gt;
    &lt;div{{ author_attributes.addClass('node__submitted') }}&gt;
      {% trans %}&lt;span class=&quot;by-author&quot;&gt;by {{ author_name }}&lt;/span&gt; {{ created_date }}{% endtrans %}
    &lt;/div&gt;
  &lt;/footer&gt;
{% endif %}

Note that when the custom format is using M for the month, the month name could be not correctly translated. See Date formats with abbreviated month name (M) are not translated using context for more details.