0

For some reason this database enters the date and time information under the name column. This is a problem because the schema shows that name is a TEXT type. So the entry is something like:

1 Jul 2023 10:22:48 (as TEXT)

It seems this format cannot be casted into a datetime format using cast as I have tried:

SELECT
  CAST(tracks.name as datetime) as datetime
FROM tracks

but this only returns a single number which is the first 1

Is there any way I could change this to the right date and time format?

I just need to see the time difference between the entries.

Bohemian
  • 412,405
  • 93
  • 575
  • 722
  • SQLite [doesn't have a date type](https://stackoverflow.com/a/4429028/256196). – Bohemian Jul 08 '23 at 03:07
  • See https://sqlite.org/lang_datefunc.html#time_values for the string formats that SQLite date and time functions understand. Use one of them or one of the numeric formats when storing dates/times in a database and your life will be much simpler. – Shawn Jul 08 '23 at 06:47

0 Answers0