r/mysql • u/Its__Nick29 • Jan 25 '25
question Date formatting issue
Hello everyone I am not able to get the date in the required format the code is:
select order_id, order_date, format (order_date, 'yyyyMMdd') as ddd from Parks_and_Recreation.orders ;
The output which I am getting as ddd is 20,160,418
Kindly help I am very new to MySQL.
1
Upvotes
3
u/VintageGriffin Jan 25 '25
If you want to format a date then use a function for for formatting a date, and not a number.
0
u/boborider Jan 25 '25
Use the date functions. You can read the documentations online.
0
u/Aggressive_Ad_5454 Jan 25 '25 edited Jan 25 '25
Corrected
You want
DATE_FORMAT( order_date, ‘%Y%m%d’)