+ 12
How can i save date in dd-mm-yyyy format in mysql and retrieve same format in php page ?
Php mysql date format issue
4 Réponses
+ 4
Ishan Shah
MySQL save data only
YYYY-MM-DD
FORMAT
+ 3
You can't save date in a different format and it's also not recommend.
What you can do is modify the format while retrieving it.
Check this : https://www.w3schools.com/sql/func_mysql_date_format.asp
+ 2
You can try this:
insert into DemoTable values(STR_TO_DATE('06-01-2019', '%m-%d-%Y'));
For select statement:
select *from DateFormatWithSelect
where UserLoginDatetime order by str_to_date(UserLoginDatetime,'%d/%m/%Y') desc;
0
insert into DemoTable values(STR_TO_DATE('06-01-2019', '%m-%d-%Y'));