1

I have a SQLite DB which has few columns of type datetime. These column store time (just the time and not the date) in HH:mm:ss format. When I try to access this field it is returned as null. In models.py this field have been mapped to equivalent models.DateTimeField.

What is the correct way of accessing such fields? Is it required that models.DateTimeField HAS TO BE stored in YYYY-MM-DD HH:mm:ss format insqlite?

Haris Farooqui
  • 944
  • 3
  • 12
  • 28

1 Answers1

2

I am not suprised that DateTimeField expects both a date and a time.

Try TimeField instead.

(Please note that SQLite does not have a native date/time type; it's just a string.)

CL.
  • 173,858
  • 17
  • 217
  • 259