How to sort by weeknumber in SQLite in Python

2019-03-04 14:40发布

Edited : I have a database which stores a date, from which the weeknumber is generated, and is then put into a format with the year ie the first week in January would be 01/2019. Below is the code I've used. This weeknumber/year is stored inside of a database in the same format. What method should I use to order the weeknumber? Is there a specific method involving specifying a database format as you do for date or would I be better off using a statement which when the user wants to order the database in terms of weeknumber, forces the system to order it in terms of date?

WeekNumberYear = (datetime.date(int(Date[0]), int(Date[1]), int(Date[2])).isocalendar())

WeekYear = (str(WeekNumberYear[1]) + "/" + str(WeekNumberYear[0]))

0条回答
登录 后发表回答