codice:<script type="text/javascript"> <!-- var _oldDate = "19/02/1986"; /* original date in format dd/mm/yyyy */ var _addDays = 30; /* days to add to the date */ /*************************************************************************************************/ var _newDate = null; var _tmpDate = null; _oldDate = _oldDate.split( '/' ); _tmpDate = new Date( _oldDate[2], _oldDate[1]-1, _oldDate[0] ); _tmpDate = new Date( _tmpDate.getTime( ) + _addDays*24*60*60*1000 ); _newDate = ( _tmpDate.getDate() > 10 ? _tmpDate.getDate() : "0" +_tmpDate.getDate() ) + '/' + ( _tmpDate.getMonth()+1 > 10 ? _tmpDate.getMonth()+1 : "0" + (_tmpDate.getMonth()+1) ) + '/' + _tmpDate.getFullYear(); /*************************************************************************************************/ alert( _newDate ); /* '_newDate' contains the modified date */ //--> </script>



Rispondi quotando