Wednesday, July 18, 2012

Date Conversion With Perl

Recently I've started to keep a personal log as I'm coding.  This has already started to be a big help in terms of not-resolving problems while I'm working on a project.  At the same time, a number of my friends have started learning to code.

Since my logs are already pretty close to blog-post sized, I'll start posting a few of the more interesting ones, in hopes that they'll help people who are working on similar projects.

Recently, I've been working on a project where I want to use SQLite to work on some data files.  The data were initially stored in CSV files.  In the last couple days, I've gotten them converted to tab-delimited files, which will work better for the specific application.

The latest challenge came about when I was trying to use some date and time information in my data files.  It turns out that I'd downloaded them with the dates in a slightly wrong format.

In my files, the dates look like this:

29-Jun-04 13:04:40

SQLite wants dates that look like this:


2004-06-29 13:04:40