vendredi 29 août 2014

Join Date and Time to DateTime in VB.NET


Vote count:

0




I am retrieving data from DB where there is a separate date and time fields. I want to join them into a DateTime field in my VB.NET project. How would you suggest accomplishing this?


I tried this but it's not working for me. "String was not recognized as a valid DateTime."



Dim InDate As New DateTime(incident.IncidentDate.Value.Year, incident.IncidentDate.Value.Month, incident.IncidentDate.Value.Day, 0, 0, 0)
Dim InTime As New DateTime(1900, 1, 1, incident.IncidentTime.Value.Hour, incident.IncidentTime.Value.Minute, incident.IncidentTime.Value.Second)


Dim combinedDateTime As DateTime = DateTime.Parse((InDate.ToString("dd/MM/yyyy") + " " + InTime.ToString("hh:mm tt")))

rdtpIncidentDateTime.SelectedDate = combinedDateTime


asked 1 min ago







Join Date and Time to DateTime in VB.NET

Aucun commentaire:

Enregistrer un commentaire