I have a little problem that I just cannot seem to solve. I have two datetime variables, the important data in the one is the year, month and day. The other datetime variable stores the hour, minute and second.
The reason for this chaos is due to the database where I'm pulling the data from, where they have two different columns to store the actual date and the time. Here is the code:
DateTime date = Convert.ToDateTime(dTable.Rows[i][0]); DateTime time = Convert.ToDateTime(dTable.Rows[i][1]); DateTime newDateTime = new DateTime();
The newDateTime need to have the complete datetime set, where the date fraction is in the date variable and the time fraction is in the time variable.
This should do:
newDateTime = date.Date + time.TimeOfDay;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With