Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如果没有数据库中HTML格式的时间,如何显示日期格式?_Python_Html_Flask - Fatal编程技术网

Python 如果没有数据库中HTML格式的时间,如何显示日期格式?

Python 如果没有数据库中HTML格式的时间,如何显示日期格式?,python,html,flask,Python,Html,Flask,我正在做一个查询,给我带来了一些数据,但我不知道如何将格式日期和时间转换为日期,如果你们中的任何人知道如何做,将帮助我很多,谢谢 蟒蛇 feh = [dict(codigo=row[1],descripcion=row[2],cantidad=row[8],fecha=row[10]) for row in cur.fetchall()] HTML 密码 描述 量 日期 A511 魁索克 951 2019-09-11 12:15:07.903000 假设行[10]是datetime对

我正在做一个查询,给我带来了一些数据,但我不知道如何将格式日期和时间转换为日期,如果你们中的任何人知道如何做,将帮助我很多,谢谢

蟒蛇

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


密码
描述
量
日期
A511
魁索克
951
2019-09-11 12:15:07.903000

假设
行[10]
datetime
对象,它有一个
.date()
方法,只返回时间戳的日期部分

请尝试
fecha=row[10].date()

<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>