"radiolandog" <martykilroy at yahoowrote in message
news:EE**********************************@microsof t.com...
>
I am getting a DateTime value from a Calendar Control. It returns the
date
at midnight. I want to add some hours to the value before I display it in
a
text box.
C# back end to a web form - here's the code:
--------------------------------------------------------------------------
-----------
private DateTime startTime;
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
startTime = Calandar1.SelectedDate;
startTime.AddHours(8.5);
startDateTextBox.Text = startTime.ToString();
}
--------------------------------------------------------------------------
-----------
>
If I debug and step through the code, startTime gets set to the selected
data at 12:00:00 AM. The AddHours method does not change its value, it
stays
at 12:00:00 AM.
microsoft.public.dotnet.framework.aspnet
Would be a better group to ask, this group is for Classic ASP.
However try:-
startTime = startTime.AddHours(8.5);
>