JAVASCRIPT : Récupérer date en javascript (date du client)


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script type="text/javascript">
  2. var current_date = new Date();
  3.  
  4. var day = current_date.getDay();
  5. var day_number = current_date.getDate();
  6. var month = current_date.getMonth();
  7. var year = current_date.getFullYear();
  8.  
  9. var day_table = new Array("Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi");
  10. var month_table = new Array("Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Decembre");
  11.  
  12. document.write( day_table[day] + " " + day_number + " " + month_table[month] + " " + year); //ex : Lundi 1 Octobre 2003
  13. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.