|
-
Dec 23rd, 2009, 11:24 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Date + Date
Hi all,
Merry Christmas to you all.
I have a question 
Let's say I have a count like 20 Days or 1 Week or 2 Months.
I like to add these value to Today Date.
without chopping, checking and adding the value is there any way I can do it ?
Because now my user may choose 20 or 10 days, or 1 week or 2 weeks, or 3 months or 1 month. (even years!!)
And I need to add this value to Today. (This is a processing for Getting Expiry Date)
I'm kind of stuck here.
The only way I can think of is chopping out Date or Month or Year and plus the user key-in value to this. And re-calculate the value and display it on screen.
Its kind of messy.
So, any idea??
Thanks.
scsfdev
-----------------------------------------------
Merry Christmas and Happy New Year to you all.
-
Dec 23rd, 2009, 11:54 PM
#2
Frenzied Member
Re: Date + Date
Check out the DateAndTime class.
DateAndTime.DateAdd method
-
Dec 24th, 2009, 12:00 AM
#3
Frenzied Member
Re: Date + Date
Wrong class
Check out the DateTime class
Look for the Add methods.
-
Dec 24th, 2009, 07:17 AM
#4
Re: Date + Date
 Originally Posted by FourBlades
Wrong class
Check out the DateTime class
Look for the Add methods.
DateTime is a structure, not a class. Doesn't really make much difference to the way it's used in many cases, including this case, but it's important to know whether you're dealing with reference types or value types much of the time.
-
Dec 24th, 2009, 08:39 AM
#5
Re: Date + Date
Some code info here.
http://msdn.microsoft.com/en-us/libr....datetime.aspx
Code:
Dim dtF As New DateTime
dtF = DateTime.Now.AddMonths(1)
-
Dec 27th, 2009, 11:02 PM
#6
Thread Starter
Addicted Member
Re: Date + Date
Hi all,
thanks for all ur suggestions. It solved my problems.
I feel more and more of lack behind in .Net environment 
According to this example, i don't even know such easy things. I feel ashamed of my ability. I still need more to learn.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|