How to pull date/time in french format for wordpress post?

Question

I am working on a wordpress post in which I want the date/time in frech format as shown below:

ENGLISH

By FJ
Published April 9, 2019 at 4:05 p.m.
Last updated April 9, 2019 at 4:14 p.m.


FRENCH

Un texte de FJ
Publié le 9 avril 2019 à 16 h 05
Mis à jour le 9 avril 2019 à 16 h 14

I have used the following code to pull the date/time in english/french for wordpress post:

<strong><?php if(ICL_LANGUAGE_CODE=='en'){ ?>
By
<?php }else{ ?>
Un texte de
<?php  } ?><?php the_author(); ?> </strong><br>
<strong><?php if(ICL_LANGUAGE_CODE=='en'){ ?>
Published
<?php }else{ ?>
Publié le
<?php  }  ?><?php the_time('F j, Y'); ?> <?php if(ICL_LANGUAGE_CODE=='en'){ ?>
at
<?php }else{ ?>
à
<?php  }  ?> <?php the_time('g:i a'); ?> </strong><br>
<strong><?php if(ICL_LANGUAGE_CODE=='en'){ ?>
Last updated
<?php }else{ ?>
Mis à jour le
<?php  } ?><?php the_modified_time('F j, Y'); ?> <?php if(ICL_LANGUAGE_CODE=='en'){ ?>
at
<?php }else{ ?>
à
<?php  }  ?> <?php the_modified_time('g:i a'); ?> </strong>

The above code displays the following o/p which is not correct(date and time format) in the case of french. English is fine but french doesn’t seem to work.

By FJ
Published April 9, 2019 at 4:05 p.m.
Last updated April 9, 2019 at 4:14 p.m.

Un texte de FJ
Publié le avril 9, 2019 à 4:05
Mis à jour le avril 9, 2019 à 5:14
0
user5447339 2 months 0 Answers 14 views 0

Leave an answer