Jose  Flores
Jose Flores

Reputation: 132

How can I display the date format without the time in HTML from the database?

I am making a query that brings me several data but I do not know how to convert the format date and time to date, if any of you have an idea of how to do it would help me a lot thanks.

enter image description here

python

   feh = [dict(codigo=row[1],descripcion=row[2],cantidad=row[8],fecha=row[10]) for row in cur.fetchall()]

HTML

<div class="jumbotron">
 <form class="form-inline my-2 my-lg-0">
 <table class="table" class="w-auto p-3">
   <thead class="w-auto p-3">
     <tr>
       <th scope="col">Code</th>
       <th scope="col">description</th>
       <th acope="col">quantity</th>
       <th scope="col">date</th>
     </tr>
   </thead>
   <tbody >
        <tr>

     <tr>

      <td>A511</td>
       <td>Queso K </td>
       <td>951.00</td>
       <td>2019-09-11 12:15:07.903000</td>

    </tr>


   </tbody>


 </table>
   </tbody>

 </div>

  </div>

Upvotes: 0

Views: 497

Answers (1)

John Gordon
John Gordon

Reputation: 33310

Assuming row[10] is a datetime object, it has a .date() method that returns only the date portion of the timestamp.

Try fecha=row[10].date().

Upvotes: 1

Related Questions