473,396 Members | 1,866 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.

Dates, Tomorrow and Next Day

I have a successful script for determining today's date.

Does anyone have anything for determining tomorrow and the next day since it
would have to look at the day of month and month of year?

Thanks in advance.
Jul 20 '05 #1
8 41473
"Smoke" <sm***@xatrium.com> writes:
I have a successful script for determining today's date.
Like
var today = new Date();
?
Does anyone have anything for determining tomorrow and the next day since it
would have to look at the day of month and month of year?


The FAQ gives this link to information on dates:
<URL:http://www.merlyn.demon.co.uk/js-dates.htm>
If it isn't there, it's not worth knowing.

To get the day after today (or after any day), do:

var day = new Date();
day.setDate(day.getDate()+1);

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
I cannot see from the info on your link or from your not below how this
would work. I believe also you answered my question the other week, thanks
again for that. Below is what is working. If today was the 31st of December
2003, how would a script look that would know to automatically know that
tomorrow would be 01012004?

var d = new Date();

var filename = "" + (d.getMonth() + 1) + (d.getDate()) + (d.getFullYear());

var fileextension = ".gif";

var file = filename + fileextension;

document.write("<img src=http://www.website.com/graphics/"+file+"
width='358' height='233' border='0' alt='' >");

the url below is only good for today

http://www.xatrium.com/fishing/today.htm

"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:wu**********@hotpop.com...
"Smoke" <sm***@xatrium.com> writes:
I have a successful script for determining today's date.
Like
var today = new Date();
?
Does anyone have anything for determining tomorrow and the next day since it would have to look at the day of month and month of year?


The FAQ gives this link to information on dates:
<URL:http://www.merlyn.demon.co.uk/js-dates.htm>
If it isn't there, it's not worth knowing.

To get the day after today (or after any day), do:

var day = new Date();
day.setDate(day.getDate()+1);

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors:

<URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html> 'Faith without judgement merely degrades the spirit divine.'

Jul 20 '05 #3
Smoke wrote on 19 nov 2003 in comp.lang.javascript:
I cannot see from the info on your link or from your not below how
this would work.


[please do not underquote on usenet]

Try this:

<SCRIPT>
var myday = new Date(2003,12,31);
alert(myday)
myday.setDate(myday.getDate()+1);
alert(myday)
</SCRIPT>

As you see a day set to 2003-12-32
will be automaticly be stored by .setDate as 2004-01-01.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #4
Evertjan. wrote on 19 Nov 2003:
Smoke wrote on 19 nov 2003 in comp.lang.javascript:
I cannot see from the info on your link or from your not below how
this would work.
[please do not underquote on usenet]

Try this:

<SCRIPT>


Type?
var myday = new Date(2003,12,31);
This isn't correct. Those values will produce a date of Saturday, 31
January 2004. Month ordinals, when used with the getMonth/setMonth
methods, their UTC counterparts, and the Date constructor, are zero
based. The correct assignment is:

var myday = new Date( 2003, 11, 31 );
alert(myday)
myday.setDate(myday.getDate()+1);
alert(myday)
</SCRIPT>

As you see a day set to 2003-12-32
will be automaticly be stored by .setDate as 2004-01-01.


Mike

--
Michael Winter
M.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Jul 20 '05 #5
JRS: In article <Xn********************@194.109.133.29>, seen in
news:comp.lang.javascript, Evertjan. <ex**************@interxnl.net>
posted at Wed, 19 Nov 2003 17:45:15 :-
Smoke wrote on 19 nov 2003 in comp.lang.javascript:
I cannot see from the info on your link or from your not below how
this would work.
[please do not underquote on usenet]

^^^^^^^^^^

That word actually means "quote too little". The chief sin is in fact
overquoting. Try "Please do not bottom-quote in News".

As you see a day set to 2003-12-32
will be automaticly be stored by .setDate as 2004-01-01.


OP : see <URL:http://www.merlyn.demon.co.uk/js-date1.htm#FR>, Field
Rollover.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Jul 20 '05 #6
Michael Winter wrote on 19 nov 2003 in comp.lang.javascript:
This isn't correct. Those values will produce a date of Saturday, 31
January 2004. Month ordinals, when used with the getMonth/setMonth
methods, their UTC counterparts, and the Date constructor, are zero
based. The correct assignment is:

var myday = new Date( 2003, 11, 31 );


You are right, my mistake.

The example stil shows the right result changing the 31st
by storing the 1st of next month.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #7
Dr John Stockton wrote on 19 nov 2003 in comp.lang.javascript:
[please do not underquote on usenet]

^^^^^^^^^^

That word actually means "quote too little". The chief sin is in fact
overquoting. Try "Please do not bottom-quote in News".


Right John, the result of posting alsio in Dutch NG's.
As you see a day set to 2003-12-32
will be automaticly be stored by .setDate as 2004-01-01.


You didn't you miss my mistake?
new Date(2003,12,31); // new Date(2003,11,31);

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #8
JRS: In article <Xn******************************@193.38.113.46> , seen
in news:comp.lang.javascript, Michael Winter <M.******@blueyonder.co.uk.
invalid> posted at Wed, 19 Nov 2003 22:39:28 :-
var myday = new Date(2003,12,31);


This isn't correct. Those values will produce a date of Saturday, 31
January 2004. Month ordinals, when used with the getMonth/setMonth
methods, their UTC counterparts, and the Date constructor, are zero
based. The correct assignment is:

var myday = new Date( 2003, 11, 31 );


Yes and no.

If the date is indeed constant, and the numbers are not to be replaced
at a later stage by variables,
var myday = new Date( "2003/12/31" );
is better. It is the same length, the month number is unmistakable, and
it provides an example of ISO-8601 date fields and order (numeric YDM is
never used). A truly enlightened browser would also accept the proper
form "2003-12-31".

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Jul 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Daniel M. Drucker | last post by:
Is there any way to parse tar-style dates like "tomorrow" or "next wednesday" in python, other than doing a system call to date --date="string" and then parsing its output? Daniel Drucker...
5
by: Paul Mason | last post by:
Hi folks, We have two servers running ASP.NET systems. One is live and one is development. I have recently adopted an ASP system from a colleague to nurse it back to health. On the...
7
by: Fendi Baba | last post by:
The function is called from opencalendar(targetfield). Thanks for any hints on what could be the problem. .............................................................. var...
3
by: David | last post by:
I'm new to DB2 and I need to write a query that will allow me to find specific dates instead of me having a date range asked for, I want it to be calculated. I've done this in Access by coding...
9
by: deko | last post by:
What is it with these dates? What are they so much trouble? All I want to do is subtract an hour, but not if that makes dtmTest less than dtmClt. Dim dtmStart As Date Dim dtmEnd As Date Dim...
8
by: Notgiven | last post by:
Say you have two dates, 2005-01-01 and 2005-01-24. I want to get a list or array or all the date between and including those two dates. I want to include this list in a query so I need it in a...
5
by: Elainie | last post by:
I need to get the dates between now and next week but using Now and Next week not any specific dates... Please help, going mad... Elaine
23
by: thebjorn | last post by:
For the purpose of finding someone's age I was looking for a way to find how the difference in years between two dates, so I could do something like: age = (date.today() - born).year but that...
4
by: ASM | last post by:
Hi, perhaps it is a ThunderBird bug perhaps it is a self bug I can't to judge : I'm not very strong with dates. I take as examples posts from : - Randy Webb :...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.