Return to Snippet

Revision: 67680
at October 16, 2014 19:05 by Igeco


Initial Code
var date = new Date();
var year = date.getFullYear();
var month =  date.getMonth()+1;
var firstDay = "01";
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
document.form.dateDebut.value = firstDay+"/"+month+"/"+year;
document.form.dateFin.value =  lastDay+"/"+month+"/"+year;

Initial URL

                                

Initial Description
Permet de préremplir des champs avec le premier et le dernier jour du mois courant au format jj/mm/aaaa

Initial Title
FILL DATE INPUT WITH FIRST AND LAST DAY OF CURRENT MONTH

Initial Tags
form, date

Initial Language
JavaScript