?
Solved

Todays Date and Tommorows Date in format dd MMMM yyyy

Posted on 2004-04-11
4
Medium Priority
?
2,806 Views
Last Modified: 2007-12-19
hello the title pretty much says it all.
i want to display todays date and then tommorows date in format
'11 April 2004'
'12 April 2004'

but i am clueless when it comes to adding 1 day.
thanks.

Fuzz.
0
Comment
Question by:Fuzzy_VB
4 Comments
 
LVL 1

Accepted Solution

by:
stephenmmitchell earned 2000 total points
ID: 10801006
Below is the code you will need

----------------------------------------------------------------------------------
<html>
      <head>
            <script language="javascript">
                  <!--
                        aMonths = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
                        function getToday(){
                              d = new Date(new Date().valueOf());
                              now =d.getDate()+' '+aMonths[d.getMonth()]+' '+d.getYear();
                              alert(now);                              
                        }
                        function getTomorrow(){
                              d = new Date(new Date().valueOf() + 86400000);
                              now =d.getDate()+' '+aMonths[d.getMonth()]+' '+d.getYear();
                              alert(now);                              
                        }
                  //-->
            </script>
      </head>
      <body>
            <input type="button" value="Today" onclick="getToday()"><br>
            <input type="button" value="Tomorrow" onclick="getTomorrow()">
      </body>
</html>
----------------------------------------------------------------------------------

Hope this helps
0
 
LVL 4

Expert Comment

by:apprenti
ID: 10801067
Better to use getFullYear()
0
 
LVL 25

Expert Comment

by:devic
ID: 10801089
apprenti is right, for mozilla and opera d.getYear() returns 104

also:
d = new Date(new Date().valueOf());  -->  d = new Date();
0
 

Author Comment

by:Fuzzy_VB
ID: 10801142
thanks apprenti and devic.
if only i could spread the love ;)

cheers.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question