karimgarza Posted August 21, 2003 Posted August 21, 2003 I want to know how can I add the time in one datetime variable to a date in another datetime variable. dim startDate as DateTime dim StartTime as DateTime startDate = startDate + StartTime I would appreciate any ideas as how to do that. Thanks in advanced Quote You're either a one or a zero. Alive or dead.
*Experts* mutant Posted August 21, 2003 *Experts* Posted August 21, 2003 Here is an example: 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 :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.