I am aware that Datetime is saved in the database in this format : 2016-09-27 00:00:00 and I am happy with that as I am used to PHP.
However, in C#, when I select the datetime from database, and perform
reader["date"].ToString()
This is what I get: 27/09/2016 12:00:00AM
Is there any way to change the datetime format to 2016-09-27 00:00:00
?
Beside of course using STR_DATE() on all my queries, which will be messy.
Regards.
You can use ToString("yyyy-MM-dd HH:mm:ss")
reader["date"].ToString("yyyy-MM-dd HH:mm:ss");