+ 1
How to change date storedin variable in 'dd/mm/yyyy' different format to yyyy/mm/ dd and store in mysql databases
change ddmmyyyy date format to yyyymmdd and store in different variable .. bootstrap date picker used. I want to store to database as yyyymmdd format start date = ddmmyyyy check-in date = start date in yyyymmdd format how to assign in PHP or js store in MySQL post method
3 Answers
+ 7
To store dates or times in MySQL useĀ date,Ā datetimeorĀ timestamp. I'd recommend the first two for most purposes.
To tell MySQL how to parse your date format use theĀ STR_TO_DATEĀ function. Here's an example:
CREATE TABLE table1 (`Date` Date); INSERT INTO table1 (`Date`) VALUES (STR_TO_DATE('01/05/2010', '%m/%d/%Y')); SELECT * FROM table1; Date 2010-01-05
To format the results back into the original form look at theĀ DATE_FORMATfunction. Note that you only need to format it if you want to display it as a string using something other than the default format.
āāā :)
https://stackoverflow.com/questions/2869874/how-store-date-in-mysql-database
+ 1
MySQL stores 0000/00/00 values in tables instead of storing 22/12/2017 captured in HTML response enter in value of start date of form post
syntax error will be there , rough demo to clarify questions answer
create table room details(
check-in date = echo _post ( start date);
check-out date = echo _post( end date;
insert values got in HTML response how to post
how to get date in ddmmyyyy format to yyyymmdd format
0
$date = date('Ymd');
put this variable to your database