473,396 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

have js date function to get today's date, need tomorrow's date

Hello i am in need of some help with this JS function. I am using a script which gets Today's date, and i am looking to get Tomorrow's date. I need some help. I will show you what i have and please let me know what i need to change to get the date of Tomorrow.

Thank you very much for your time.

Expand|Select|Wrap|Line Numbers
  1. <SCRIPT LANGUAGE="JavaScript">
  2.  
  3.  
  4. var now = new Date();
  5.  
  6.  
  7. var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
  8.  
  9.  
  10. var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
  11.  
  12.  
  13. var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
  14.  
  15.  
  16. function fourdigits(number) {
  17.     return (number < 1000) ? number + 1900 : number;
  18.                                 }
  19.  
  20. today =  days[now.getDay()] + ", " +
  21.          months[now.getMonth()] + " " +
  22.          date + ", " +
  23.          (fourdigits(now.getYear())) ;
  24.  
  25.  
  26. document.write(today);
  27.  
  28.  
  29. </script>
  30.  
Apr 1 '12 #1
1 1920
Dormilich
8,658 Expert Mod 8TB
the function fourdigits() is superfluous, use Date.getFullYear(). tomorrows date can be set either by calling Date.setDate() with an incremented date number or by creating a new date via new Date(year, month, day [hour, minute, second]) using Date’s getter methods. note that inexistent days are wrapped to the next month.
Apr 1 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Funnyweb | last post by:
I have just notices that the date() function is not returning the correct date/time on my "server". I am running apache2 on my winxp pro laptop. My system clock is set to the correct date,...
3
by: Sharad Gupta | last post by:
Friends I need a date simple date function that would append the coming month value in my current month like monthname(month(date)) : gives me current month in string i need next month , a...
8
by: Dennis M. Marks | last post by:
What is the maximum valid date range for the date(yyyy,mm,dd) function. -- Dennis M. Marks http://www.dcs-chico.com/~denmarks/ Replace domain.invalid with dcsi.net -----= Posted via...
1
by: Teresa | last post by:
I need to set criteria in a query to pull all transfer dates that are between 1 year before and 6 mos before Then I need to pull all service dates that are within six months of that...
4
by: Christine | last post by:
I am having the strangest problem. I use the Date function in several of my forms and modules in an Access 2000 mdb. Lately, wherever in my code (in this one mdb) I use the Date function, it...
2
by: Andy | last post by:
Hello, I have a question regarding how to format a date in VB so that I can call it from a query and get results. I'm calling functions in the query because that was the only way I found I could...
10
by: John Morgan | last post by:
Does anyone know what parameter should be used instead of Date = 0 for the optional parameter in the following function? Public Function dhAge(ByVal dtmBD As Date, Optional ByVal dtmDate As Date...
4
by: Patrick McGuire | last post by:
I need to get the current date in vb .NET. In vba I always used the Date() function, and the help in .NET indicates that this function still exists, but I can't seem to find it. The Now()...
3
by: murch.alexander | last post by:
I made a simple public function to set and return a date value (see below). I have a number of queries that call up the function to get the "As Of Date," which is typically set to today's date....
11
by: fran7 | last post by:
Hi, I wonder if anyone can help. I have a query like this <% If datediff("d", , now()) < 21 Then %> <a target=_blank title="blog" href="news</a> <% Else %>
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.