Date Convert

  • Thread starter Thread starter Islam Elkhayat
  • Start date Start date
I

Islam Elkhayat

In my C# Webapplication..
I enter the date in a textbox using popup Calender in the format
MM/dd/yyyy..
when i retrieve date from Sql server for updating using datarow to fill the
textbox the date format dd/MM/yyyy hh-mm-ss i want to convert it back to the
original format & ommit the time..

How can i convert this back so i void the exception if user didn't change
date in the update form??
Any help plz
 
Hi,

You can convert a DateTime to string as desired using DateTime.ToString() ,
like this:
DateTime.Today.ToString( "dd/MM/yy", DateTimeFormatInfo.InvariantInfo );

In a similar way you can use DateTime.Parse or DateTime.ParseExact


Cheers,
 
Back
Top