I have a variable; i.e. oDateTime with the type of DateTime & I extracted a time from it as follows:
string.Format("{0:t}", oDateTime);
Now my output is 4:00AM
My dropdownlist controls having the values like 01,02.....12 for Hours and 01,02...59 for Minutes & AM,PM for FormatDropdown control.
Now here on button click event it will retrieve the values & will show those values in controls as selected value as follows:
ddlTFHrs.SelectedValue = String.Format("{0:hh}", oDateTime);
ddlTFMin.SelectedValue = String.Format("{0:mm}", oDateTime);
ddlTFAMPM.SelectedValue = String.Format("{0:tt}", oDateTime);
Here I am getting an error when I try to compare 04 with 4.
Can I format the time in string format as 04 or else is there any alternate way to compare these two values?
Thanks