12,689,968 members (25,588 online)
Rate this:
See more:
Hi Everyone,

While i was working with classic ASP, I got a doubt that

What is the difference between

Both returns the same output. Both adds 10 days to the current datetime.
Is there any scenario where we can see the difference, so that i can use them exactly where they are required. I need the practical scenario not the theoretical definitions. If possible mail me [address removed]

Posted 18-Sep-12 5:24am
Updated 18-Sep-12 5:25am
v2
Wes Aday 18-Sep-12 10:40am

What is wrong with reading how to use the function? http://www.ezineasp.net/post/ASP-Vbscript-DateAdd-function-with-Date-Intervals.aspx
Member 9014578 18-Sep-12 11:14am

Thanks for you Comment. Actually i did that before itself.

My Problem is: both the parameters "w" and "d" when used with data function return the same output. What is the exact difference between the two parameters. Can you give an example where i can see the difference between them.

Rate this:

## Solution 1

The documentation here tells the difference:
HERE

d - is day of the month
w - is day of the week

Now for your purpose / dateadd () function - the interval parameter only indicates what unit of time you are adding to your initial date [10 days, months, years etc]
So for this function: d, w, and even y will be identical, because they are only telling the function "add x days"

For other functions there is a difference between the two
v2
Member 9014578 18-Sep-12 11:13am

Thanks for that. Got clarity to some better extent.
As per your post w - is day of the week. Wqe know there are only 7 days a week. But when i specify 10 in place of w, i am getting the correct output, but as per the documentation reference given above It should be wrong because weekday must be between 1-7. Can you please clarify
Shaunak De 18-Sep-12 11:19am

You are a little confused on this. :)

Its very simple. Irrespective of w, d, or y, you are adding 10 "days". That is important in the adddate function. The interval is "day".

w will be used when you want to check if today is a monday or not, etc.

See the datepart method for use: http://msdn.microsoft.com/en-us/library/2dhha2f3.aspx

Member 9014578 18-Sep-12 11:24am

Got it. Thanks Dude....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 OriginalGriff 270 ppolymorphe 200 KarstenK 140 Ashwin. Shetty 120 Richard MacCutchan 95
 OriginalGriff 2,593 Peter Leow 1,835 Mika Wendelius 1,743 Jochen Arndt 1,204 ppolymorphe 1,106

Advertise | Privacy | Mobile
Web02 | 2.8.170113.4 | Last Updated 18 Sep 2012