alert(calc_date(12));
function calc_date($date) {
var today = new Date();
var calc_date = $date;
today.setMonth(today.getMonth() - calc_date);
var y = today.getFullYear();
var m = ('0' + (today.getMonth() + 1)).slice(-2);
var d = ('0' + today.getDate()).slice(-2);
var date = d + '.' + m + '.' + y;
return date;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.