Forum Moderators: open

Message Too Old, No Replies

calculating date for a coming day

         

laura2k

1:16 am on Jan 6, 2004 (gmt 0)



Hello,

I have a ASP script that displays the date for the week begining of each week. For example if i was to execute the script today (Tuesday 06 January) the script will display the week begining as 05-01-04

it basically displays the week begining monday. i've made the script link to a blank script and add a digit to it. So for example if i wanted to know the date for sunday, the script links to test.asp?day=6 and that way the test.asp can add 6 to the the week begining date.

But the problem i am having is that if the week begining in lets say 29th and i add 6 to that, it will give me the date as being 35th which is well out of the calendar. Also, some months have 29, some have 30 and some have 31, so i need to be able to have this validation.

Can anyone please help me achive this.

Many thanx in advance

txbakers

2:18 am on Jan 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



most database SQL has a "dateadd" type of function which can do it. There are also some scripting languages commands which have date add functions.

korkus2000

3:02 am on Jan 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is what you want:
[msdn.microsoft.com...]

NewDate = DateAdd("d", Request.QueryString("day"), Now())