Here, i posted the code below to get the date of seventh day from today using javascript.
Code:
step:1
step:2
step:3
Finally ,we displayed the date of the seventh day from today using javascript.
Code:
step:1
var date = new Date(); //to get current day's date with GMT//i.e, the variable date outputs as Tue Dec 17 2013 00:48:41 GMT+0530 (India Standard Time)
step:2
date.setDate(date.getDate() + 7);//Now the variable date holds the timestamp of the seventh'day from today i.e, 1387826522433
step:3
var dateMsg = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();//just checking with a alert ,
alert(dateMsg);
alert(dateMsg);//Now variable dateMsg outputs with format as 2013-12-24,
Finally ,we displayed the date of the seventh day from today using javascript.
alert(dateMsg);
No comments:
Post a Comment