get datetime values from database in dd/MM/yyyy HH:mm:ss format irrespective of system date/time format
-
I run the below query in SQL server through C#. SELECT ScheduleTime FROM test I'm using SqlDataAdapter to fill the results in datatable. I'm getting "ScheduleTime" values from test table ("ScheduleTime" is datetime type). But the results are in system date time format. For example, if my system Time format is "tt hh:mm:ss" in Long Time, the results are in the below format. 27-03-2013 PM 03:51:01 if my system Time format is "HH:mm:ss" in Long Time, the results are in the below format. 27-03-2013 15:51:01 I need to get the results in dd/MM/yyyy HH:mm:ss format irrespective of system date/time format. Please guide me to this. Thanks in advance.
-
I run the below query in SQL server through C#. SELECT ScheduleTime FROM test I'm using SqlDataAdapter to fill the results in datatable. I'm getting "ScheduleTime" values from test table ("ScheduleTime" is datetime type). But the results are in system date time format. For example, if my system Time format is "tt hh:mm:ss" in Long Time, the results are in the below format. 27-03-2013 PM 03:51:01 if my system Time format is "HH:mm:ss" in Long Time, the results are in the below format. 27-03-2013 15:51:01 I need to get the results in dd/MM/yyyy HH:mm:ss format irrespective of system date/time format. Please guide me to this. Thanks in advance.
convert the date to show your desire format eg. DateTime dt = yourdatabasedate; string showdate = dt.ToString("dd/MM/yyyy"); for you : use this format "dd/MM/yyyy HH:mm:ss"
-
convert the date to show your desire format eg. DateTime dt = yourdatabasedate; string showdate = dt.ToString("dd/MM/yyyy"); for you : use this format "dd/MM/yyyy HH:mm:ss"