python datetime.datetime => convert datetime to string
2022. 3. 26. 18:59ㆍBackEnd

eventList = []
updatedate = ''
for q in range(0, len(temp)):
tempdict =dict()
tempdict["title"] = temp[q][0]
tempdict['subject'] = temp[q][1]
updatedate = temp[q][2]
tempdict['updateDate'] = updatedate.strftime("%Y.%m.%d")
tempdict['adminId'] = temp[q][3]
tempdict['url'] = temp[q][4]
tempdict['startDate'] = temp[q][6]
tempdict['endDate'] = temp[q][6]
eventList.append(tempdict)

postgres 기준 최초 select 시 string으로 뽑아내는 방법
SELECT id, title, subject,TO_CHAR(date,'YYYY-MM-DD'), adminid, image FROM eventweb WHERE active = true ORDER BY date DESC

'BackEnd' 카테고리의 다른 글
| 도메인 추가 할 때 참고 하던 싸이트 (0) | 2022.04.04 |
|---|---|
| systemctl 사용 (0) | 2022.03.29 |
| currenttime() - 현재시간 함수화 (0) | 2022.03.25 |
| REFERENCES 외래키 주기 (0) | 2022.03.24 |
| 2022-03-23(erc 셋팅 ) (0) | 2022.03.24 |