PDA

View Full Version : ASP.Net Datetime


JMJ33
11-06-03, 10:41 AM
I have a variable in an aspx page with a variable called "Lead_Date". "Lead_Date" represents a "datetime' variable in a database. I want to have another variable called "DNC_Date" be equal to "Lead_Date" plus 80 days. All my attempts at this have failed.

Any Suggestion?

Thanks

JMJ33

hyjacked
11-06-03, 10:57 AM
I'm not sure if this applies, but in another language I've used(SAL for SQLWindows), I had to convert the date to a number, then figure out what number represents the adjusted time(80 days in your case), then add the 2.

I haven't figured out how asp stores the date values yet but this might still apply.

Kenrette
11-06-03, 04:57 PM
Have you looked at the DateAdd function? It allows you to add to an existing date (Lead_Date) by months, years, or days (80).

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctdateadd.asp

usage will vary depending on what scripting language you are using, but it is a fairly universal function.

I have a variable in an aspx page with a variable called "Lead_Date". "Lead_Date" represents a "datetime' variable in a database. I want to have another variable called "DNC_Date" be equal to "Lead_Date" plus 80 days. All my attempts at this have failed.

Any Suggestion?

Thanks

JMJ33

ballison222
03-07-04, 09:26 PM
Try using a TimeSpan to specify the number of days, hours, minutes, and seconds.

[Visual Basic] Public Sub New(Integer, Integer, Integer, Integer)
[C#] public TimeSpan(int, int, int, int);
[C++] public: TimeSpan(int, int, int, int);
[JScript] public function TimeSpan(int, int, int, int);


I have a variable in an aspx page with a variable called "Lead_Date". "Lead_Date" represents a "datetime' variable in a database. I want to have another variable called "DNC_Date" be equal to "Lead_Date" plus 80 days. All my attempts at this have failed.

Any Suggestion?

Thanks

JMJ33