I am working on a way to tag the movies that I convert and put into iTunes.
Presently I have to manually export the database to a txt file and query that in bash. this works great and gives me the format of the dates that I want (i.e YYYY-MM-DD).
I am able to have sqlite dump the database to a text file automatically however the timestamp for an entry is "185457600" instead of the 2006-11-17.
Is there any way I can have the dates converted to YYYY-MM-DD format either as the dump occurs or with bash when it looks up the information in the text file?
Any help would be appreciated.
Thanks for a great program.
Timstamp fun
Re: Timstamp fun
Sqlite3 does not allow a conversion of the timestamp to a date during the dump, but you can do it in the bash shell with the following function:
I started from this post and amended to work with Mac OS X.
Code: Select all
stamp2date (){
#Add seconds to match Unix reference date from Mac OS X 2001-01-01 reference date.
seconds=$(( $1 + 978328800 ))
date -r $seconds "+%Y-%m-%d"
}
# from timestamp to date
stamp2date 185457600 #tested outputs "2006-11-17"