Hi ,
I am converting MM/dd/yyyy date to yyyy-MM-dd hh:mm:ss using dateobject.ToString("yyyy-MM-dd hh:mm:ss").
Its converting perfectly in given format but in MM-dd-yyyy format there is no hour specified and hour is appearing in this yyyy-MM-dd hh:mm:ss format .
For e.g. date is 05/07/2009 i.e. 7 May 2009 and after converting to yyyy-MM-dd hh:mm:ss format, date is appearing as 2009-05-07 12:00:00.
From where this 12 is appearing ? We don't want this 12 . The date should display like 2009-05-07 00:00:00.
Please suggest solution.
Thanks
Prasad
Loading
Jiteendra SampathiraoPosted May 2, 2011, 8:41 AM
Go through these links:
http://www.sql-server-helper.com/tips/date-formats.aspx
http://msdn.microsoft.com/en-us/library/az4se3k1.aspx
Jiteendra SampathiraoPosted May 2, 2011, 8:31 AM
Do like this::
string @DOB = DateTime.ParseExact(txtDOB.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.CurrentUICulture. DateTimeFormat).ToString("MM/dd/yyyy");
Otherwise post the code here...
Abhimanyu K VatsaPosted May 2, 2011, 8:15 AM
thanks
Prasad GodbolePosted May 2, 2011, 7:53 AM
Thanks for giving solutions.
I used 24 hours date format and now hour is appearing 00.
Thanks again
Kind Regards
Prasad
Abhimanyu K VatsaPosted May 2, 2011, 7:24 AM
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
VulpesPosted May 2, 2011, 7:23 AM
VulpesPosted May 2, 2011, 7:05 AM