title: select all sales from specific day ? mysql , convert datetime to date
body: <p>how to convert the DateTime column to date?</p>
  <p>I need something like the <code>select * from sales where date =  = &quot;2022-09-18&quot;;</code></p>
  <p>I need to get all sales from a specific day</p>
  <p>I tried this <a href="https://stackoverflow.com/questions/7527315/how-can-i-convert-datetime-to-date-truncating-the-times-leaving-me-the-dates">How can I convert datetime to date, truncating the times, leaving me the dates?</a>
  and many more solutions but nothing is working.</p>
  <p>i tried this <code>SELECT  DATE(</code>datatime<code>) AS  date_of_booking FROM sales; &quot; ;</code>
  but it gave me this <a href="https://i.stack.imgur.com/g2RCo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/g2RCo.png" alt="enter image description here" /></a></p>
  <p>I tried also this but it gave me error this</p>
  <p>this is a table named <code>Sales</code></p>
  <p><a href="https://i.stack.imgur.com/iEmhl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iEmhl.png" alt="enter image description here" /></a></p>
  <p>if there is anybody that can help me understand how do I get this thing to work please i really appreciate that! a lot .</p>
  <p>code for generating the database if you want</p>
  <pre><code>DROP DATABASE IF EXISTS ice_cream_store;
  CREATE DATABASE IF NOT EXISTS ice_cream_store;
  USE ice_cream_store; 
  
  CREATE TABLE `Tastes` (
      `tid` INTEGER NOT NULL AUTO_INCREMENT primary key,
      `name`  VARCHAR(20) NOT NULL,
      UNIQUE (name)
  );
  CREATE TABLE `Toppings` ( 
      `topid` INTEGER NOT NULL AUTO_INCREMENT primary key,
      `name`  VARCHAR(20) NOT NULL,
      UNIQUE (name)
  );
  CREATE TABLE `Receptacles` ( 
      `rid` INTEGER NOT NULL AUTO_INCREMENT primary key,
      `name`  VARCHAR(20) NOT NULL,
      `price` int NOT NULL,
      UNIQUE (name)
  );
  
  CREATE TABLE `Sales` ( 
      `sid` INTEGER NOT NULL AUTO_INCREMENT primary key,
      `rid` integer not null,
      foreign key (`rid`) references Receptacles(`rid`),
      `datetime` datetime not null, 
      `completed` bool not null,
      `paid` bool not null,
  `total_price` INTEGER NOT NULL
  );
  
  CREATE TABLE `Tastes_Sales` ( 
      `sid` integer not null,
      foreign key (`sid`) references Sales(`sid`),
      `tid` integer not null,
      foreign key (`tid`) references Tastes(`tid`),
      PRIMARY KEY (`sid` , `tid`),
      `quantity` integer not null
  );
  
  CREATE TABLE `Toppings_Sales` ( 
      `sid` integer not null,
      foreign key (`sid`) references Sales(`sid`),
      `topid` integer not null,
      foreign key (`topid`) references Toppings(`topid`),
      PRIMARY KEY (`sid` , `topid`)
  );
  
  SELECT 
         DATE(`datatime`)
           AS  date_of_booking
  FROM sales;
  
  
  select * from tastes;
  select * from Receptacles;
  select * from Toppings;
  select * from sales;
  select * from Toppings_Sales;
  select * from Tastes_Sales;
  </code></pre>