Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL statement to convert date-time format in some columns

Tags:

sql

sqlite

I have an SQLite database in which some columns are date-time strings with the format 1/2/2000 3:45:56 am.

Is there an SQL statement which can convert these values to strings with an ISO-8601-like format (2000-01-02 03:45:56)?

(One possible non-SQL way to do this would be to export the database as a CSV file, and use Python, with its csv and datetime modules, to parse the columns.)

like image 554
Winston C. Yang Avatar asked Mar 06 '26 17:03

Winston C. Yang


1 Answers

SQL As Understood By SQLite - Date And Time Functions.

like image 168
Will Marcouiller Avatar answered Mar 09 '26 11:03

Will Marcouiller