how do I parse the following x3 variables to become: 01/01/2010 9:00 (datetime column)

how do I parse the following x3 variables to become:  01/01/2010 9:00   (datetime column)

radDateTimePickerAddNoteCallBack.Value   (contains for example:  01/01/2010 00:00:00)
radComboBoxAddNoteCallBackHour.Text   (contains for example: 9)
radComboBoxAddNoteCallBackMinutes.Text  (contains for example: 00)
amillyardAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
käµfm³d 👽Connect With a Mentor Commented:
How about:
try
{
    DateTime d = Convert.ToDateTime(radDateTimePickerAddNoteCallBack.Value);
    d = d.AddHours(Convert.ToInt32(radComboBoxAddNoteCallBackHour.Text));
    d = d.AddMinutes(Convert.ToInt32(radComboBoxAddNoteCallBackMinutes.Text));
}
catch
{

}

Open in new window

0
 
käµfm³d 👽Commented:
"d" only exists inside of the "try", so you might want to move it out to use it elsewhere  :)
DateTime d;

try
{
    d = Convert.ToDateTime(radDateTimePickerAddNoteCallBack.Value);
    d = d.AddHours(Convert.ToInt32(radComboBoxAddNoteCallBackHour.Text));
    d = d.AddMinutes(Convert.ToInt32(radComboBoxAddNoteCallBackMinutes.Text));
}
catch
{

}

Open in new window

0
 
amillyardAuthor Commented:
kaufmed: spot on -- thank you :-)
0
 
käµfm³d 👽Commented:
NP. Glad to help :)
0
All Courses

From novice to tech pro — start learning today.