Solved

Todays Date and Tommorows Date in format dd MMMM yyyy

Posted on 2004-04-11
4
2,787 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

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…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

707 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