Friday, June 12, 2015

Date-Time comparisons

I started the process of creating separate HTMLs for every time slot. My previous calculations were wrong by the way. Not only are there 4 time slots per hour, 24 hours in a day, there are 7 days in a week. Thats 4 x 24 x 7 = 672! Whatever, no biggie.

One challenge I immediately ran into was comparing times. The parser spits out times in a text, possibly in the TIMEX3 format according to the documentation. I couldn't find any intelligible way to use this, but did find a useful python package called date-util. It has a parser itself that takes most time formats like "11:35am" or "14:00" and converts it into a usable format. I used this to make the necessary calculations between times.

I want to refactor the way I'm using file names and directories. I've been using filenames with hardcoded directories prepended, but that doesn't seem like the right way to go. Maybe I'll tackle that tomorrow.

No comments:

Post a Comment