Dale Massicotte
asked on
visual studio dropdownlist calculate time values
based on the current time (for example it is 4:43 PM)
my DDL shows items as follows:
NOW
4:58 PM
5:13 PM
5:28 PM
5:43 PM
5:58 PM
etc
but i would like the code to round up to the next whole 15 minutes to display instead
NOW
5:00 PM
5:15 PM
5:30 PM
5:45 PM
6:00 PM
etc
this code would have to be modified to calculate the round-up but I am not sure how to proceed
my DDL shows items as follows:
NOW
4:58 PM
5:13 PM
5:28 PM
5:43 PM
5:58 PM
etc
but i would like the code to round up to the next whole 15 minutes to display instead
NOW
5:00 PM
5:15 PM
5:30 PM
5:45 PM
6:00 PM
etc
this code would have to be modified to calculate the round-up but I am not sure how to proceed
ddlFullTime.Items.Add(New System.Web.UI.WebControls.ListItem("Now", dtNow.ToShortTimeString))
dtMod = dtMod.AddMinutes(15)
ddlFullTime.Items.Add(New System.Web.UI.WebControls.ListItem(dtMod.ToShortTimeString, dtMod.ToShortTimeString))
dtMod = dtMod.AddMinutes(15)
ddlFullTime.Items.Add(New System.Web.UI.WebControls.ListItem(dtMod.ToShortTimeString, dtMod.ToShortTimeString))
dtMod = dtMod.AddMinutes(15)
ASKER
sami it does not accept % character
(not a valid character)
(not a valid character)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You ARE the GURU!
ASKER
please also look at
Q_28365465
similar topic
Q_28365465
similar topic
ddlFullTime.Items.Add(New System.Web.UI.WebControls.
dtMod = DateTime.Now.AddMinutes(15
ddlFullTime.Items.Add(New System.Web.UI.WebControls.
dtMod = dtMod.AddMinutes(15)
ddlFullTime.Items.Add(New System.Web.UI.WebControls.
dtMod = dtMod.AddMinutes(15)
Setting the first dtMod is the key;