Posted By

jbernus on 07/13/11


Tagged

date french


Versions (?)

Date translation in french in JavaScript


 / Published in: JavaScript
 

Translate dates in french in JavaScript

  1. var d_names = new Array("dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi");
  2.  
  3. var m_names = new Array("janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre");
  4.  
  5. // date au format : 2010-09-12 18:52:10
  6.  
  7. var d1 = (date).split(' '), d1 = d1[0].split('-'), dateString = d1[1]+'/'+d1[2]+'/'+d1[0], d = new Date(dateString), jour = d.getDay(), jourm = d.getDate(), mois = d.getMonth(), annee = d.getFullYear(), postdate = d_names[jour] + ' ' + jourm + ' ' + m_names[mois] + ' ' + annee;

Report this snippet  

You need to login to post a comment.