I am working on a php code as shown below:
<?php <time datetime="<?php echo esc_attr(date_format($ts, 'H:i d-m-Y')) ?>"
data-timezone="<?php echo esc_attr($tz_param) ?>"><?php echo esc_html(date_format($ts, 'F j H:i')) ?></time> ?> // Line A
Line A returns the following date on the webpage:
July 10 21:30
print_r($ts)
prints:
DateTime Object
(
[date] => 2019-07-10 21:30:00.000000
[timezone_type] => 3
[timezone] => America/New_York
)
July 10 21:30
Problem Statement:
I am wondering what changes I should make in the php code above at Line A above so that when the page is in french, it should return the date in french.
This is what I have tried but it is still returning the date in Engllish.
<?php if(ICL_LANGUAGE_CODE=='fr'){
setlocale(LC_TIME, 'fr_FR');
?>
<time datetime="<?php echo esc_attr(date_format($ts, 'H:i d-m-Y')) ?>"
data-timezone="<?php echo esc_attr($tz_param) ?>"><?php echo strftime(esc_html(date_format($ts, 'F j H:i'))) ?></time> // Line B
<?php } ?>
Line B above still returns english.