Solved

Todays Date and Tommorows Date in format dd MMMM yyyy

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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 how to create an extensible mechanism for linked drop downs.
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…

679 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