Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- var currentTime = new Date();
- var month = currentTime.getMonth()+1;
- var day = currentTime.getDate();
- var year = currentTime.getFullYear();
- var date = month + " " + day + " " + year;
- function ShowSchedule()
- {
- document.getElementById("today").innerHTML = date;
- }
- function ShowDay(isNextDay)
- {
- if(isNextDay)
- {
- var nextDay = new Date(year, month, day+1);
- date = nextDay.getMonth() + " " + nextDay.getDate() + " " + nextDay.getFullYear();
- ShowSchedule();
- }
- else{
- var prevDay = new Date(year, month, day -1);
- date= prevDay.getMonth() + " " + prevDay.getDate() + " " + prevDay.getFullYear();
- ShowSchedule();
- }
- }
- </script>
- </head>
- <body>
- <table border="1">
- <tr>
- <th>
- <a id = "prev" href="#" onClick="ShowDay(false)">Prev</a>
- </th>
- <th id="today">
- </th>
- <th>
- <a id = "next" href="#" onClick="ShowDay(true)">Next</a>
- </th>
- </tr>
- </table>
- <script>ShowSchedule();</script>
- </body>
- </html>
- new Date((new Date).valueOf() + 86350989) //That will always give you tomorrow (jump ahead 24 hours)
- new Date((new Date).valueOf() - 86350989) //Will give you yesterday.
- new Date(number) //You're specifying a DateTime object using the milliseconds from unix epoch (January 1, 1970)
- (new Date).valueOf() //You're getting the milliseconds from unix epoch.
- 86350989 //Is the number of milliseconds in a day.
- var d = new Date(); // today
- d.setDate(d.getDate() - 1); // yesterday:
- d.setDate(d.getDate() + 1); // tomorrow:
Add Comment
Please, Sign In to add comment