1. mysql数据库
models.TerminalInfo.objects.filter(status=True).extra(
select={'created_at': 'date_format(created_at, "%%Y-%%m-%%d %%H:%%i:%%s")'})[
page_info.start():page_info.end()].values('id', 'name', 'created_at')
2. sqlite3数据库
models.TerminalInfo.objects.filter(status=True).extra(
select={'created_at': 'strftime("%%Y-%%m-%%d %%H:%%M:%%S", created_at)'})[
page_info.start():page_info.end()].values('id', 'name', 'created_at')
标签:-%%,info,格式化,created,%%,Django,orm,status,page
From: https://www.cnblogs.com/jessecheng/p/16978711.html