|
-
January 31st, 2005, 12:59 AM
#1
Scheduler with Hour/Minute support
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.
-
January 31st, 2005, 02:45 AM
#2
Re: Scheduler with Hour/Minute support
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
If you think you CAN, you can, If you think you CAN'T, you are probably right.
Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|