Solved

Todays Date and Tommorows Date in format dd MMMM yyyy

Posted on 2004-04-11
4
2,777 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 500 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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

803 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