-1

I want to return to a user a days in specific language (cs_CZ)

I have this script:

  <?php
  $date = (new \DateTime($log['date']))->format('d.m.Y');
  $date_name = (new \DateTime($log['date']))->format('D');
  ?>

I made from that this, but its not working:

<?php
setlocale(LC_ALL, 'cs_CZ');
 $date = (new \DateTime($log['date']))->format('d.m.Y');
  $date_name = (new \DateTime($log['date']))->format(strftime("%a"));
?>

What should be the problem?

Copen
  • 9
  • 2
  • I want to show date just in cs_CZ. How to replace that? Because date() always return a English date time. – Copen Jan 25 '19 at 10:27

1 Answers1

0

You should do it this way instead :

setlocale(LC_ALL, 'cs_CZ');

$date = new DateTime($log['date']);
$date = strftime("%A", $date->getTimestamp());

var_dump($date);

Feel free to test this code here.

Alexandre Elshobokshy
  • 10,720
  • 6
  • 27
  • 57