Solved

Todays Date and Tommorows Date in format dd MMMM yyyy

Posted on 2004-04-11
4
2,771 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
Comment Utility
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
Comment Utility
Better to use getFullYear()
0
 
LVL 25

Expert Comment

by:devic
Comment Utility
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
Comment Utility
thanks apprenti and devic.
if only i could spread the love ;)

cheers.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now