Add time to a datetime variable

karimgarza

Freshman
Joined
Jul 16, 2003
Messages
33
Location
Texas
I want to know how can I add the time in one datetime variable to a date in another datetime variable.

Code:
dim startDate as DateTime
dim StartTime as DateTime

startDate = startDate + StartTime

I would appreciate any ideas as how to do that.

Thanks in advanced
 
Here is an example:
Visual Basic:
Dim dstart As DateTime = DateTime.Now 'set start as now
Dim dnext As DateTime = DateTime.Now.Add(New TimeSpan(1, 0, 0, 0))
'set next date as now plus 1 day
MessageBox.Show(dstart.Add(New TimeSpan(dnext.Ticks)).ToString)
'show the date that resulted in adding the start date plus the next date
'using the TimeSpan object and Ticks property  of the next date
:)
 
Back
Top