Click to See Complete Forum and Search --> : Scheduler with Hour/Minute support


Shaitan00
January 30th, 2005, 11:59 PM
I am creating a scheduler with Year/Month/Day/Hour/Minute scheduling.
For the Year/Month/Day I used the built in calendar (<asp:calendar>) control which returns the selected date as:
DateTime dtSelected = calendar.SelectedDate;

Now I need to handle the Hour / Minute, so I created two dropdownlist boxes (if you know a better way please tell me, is there some kind of Hour/Minute control like the calendar?) one for the Hour and one for the Minutes.

After the user has selected everything I want to a) post the result and b) save the result in a SQL Database. Therefore I want to add the Hour/Minute and Year/Month/Day variables together somehow.

Is there a way to convert the current dropdownlist box results into a DateTime variable (correct format) and then merge it with the current DateTime variable that holds the Year/Month/Day so I have 1 variable with the complete schedule?

Can this be done? Is there a more efficient way?
Any ideas would help, thanks.

Andy Tacker
January 31st, 2005, 01:45 AM
you can add any datetime value in sql database...

//format("yyyy-MM-dd HH:mm:ss");
//from asp control...
string m_szDataTime = string.format("{0}-{1}-{2} {3}:{4}:{5}",
aspControlCalendar.SelectedDate.Year,
aspControlCalendar.SelectedDate.Month,
aspControlCalendar.SelectedDate.Day,
MyHourBox.Text,
MyMinuteBox.Text,
MySecondBox.Text);

string m_SQLCmd = string.Format("Update MyTable Set DateToday Values '{0}'",m_szDataTime);

//execute