I tried converting this
DateTime Todate = DateTime.ParseExact("22/08/2012", "dd/MM/yyyy", null);
got output :
8/21/2012 12:00:00 AM
How can i get date output in dd/MM/yyyy
EDIT : I am getting the text from calendar textbox as string as "22/08/2012" and now I need to convert this to dateTime Datatype to insert in to DB through DAL Class variable which is in DateTime DataType
string[] f1 = datepicker1.Text.Split(' ');
string[] t1 = datepicker2.Text.Split(' ');
DateTime Fromdate1 = DateTime.ParseExact(f1[0], "dd/MM/yyyy", CultureInfo.InvariantCulture);
//Convert.ToDateTime(datepicker1.Text);
DateTime Todate1 = DateTime.ParseExact(t1[0], "dd/MM/yyyy", null);
ObjSeasonPrice.SeasonPriceName = txtSeasonPriceName.Text.Trim();
ObjSeasonPrice.PropertyId = Convert.ToInt32(propId.ToString());
ObjSeasonPrice.RoomId = Convert.ToInt32(roomId.ToString());
ObjSeasonPrice.RatePerNight = Convert.ToDecimal(txtRatePerNight.Text);
ObjSeasonPrice.Days = getAllDaysWithComma();
ObjSeasonPrice.AdditionalBenefits = txtAdditionalBenifits.Text.Trim();
ObjSeasonPrice.Status = ddlStatus.SelectedItem.ToString();
ObjSeasonPrice.IsDeleted = Convert.ToBoolean("False");
ObjSeasonPrice.FromDate = Fromdate1;
ObjSeasonPrice.ToDate = Todate1;
Sorry for low info,but why you guys keep downvoting without taking time to understand the issue completely.