Time in a Bottle

Keeping track of the hours I work for clients has always been a hassle. My standard method was Notepad. Yep, it's sad, but I have a folder for each of my projects—along with a text file full of notes about that project. And I used to jot the amount of time I spent on the project somewhere in the file. Typically I'd have a [date] - [hours] notation, and when it was time to invoice I'd have to go back through emails to find out what those hours were spent doing. Sloppy.

I've tried using time-tracking software. Earlier this year in a fit of organizational desperation I put all of my projects and hours into a program called Timesheets Lite. It tracked hours alright, but trying to get at those hours at the end of the month was a nightmare. I could get an invoice once, but then the hours were "reconciled" and trapped in a database somewhere inside the program. Sure the software had a bunch of "features" like invoicing and reporting, but I like my manual invoicing system fine. And that's what I've found with all of the software I've tried for tracking hours: it provides an entire "workflow solution" rather than a simple way to track hours.

When I stepped back, I realized that all I needed was a stopwatch with a log. I wanted a big green button for go, a big red button for stop, a way to choose which project I'm working on, and list of all my work sessions. So I spent a few non-billable hours coding my own stopwatch, and I thought I'd share it here. It's nothing fancy: no invoicing, no reports, no charts, no to-do lists. Just a simple timer + some notes.

And it's in ASP classic just to make it even less useful. ;) But if you have a Windows server with SQL Server and want your own time-logger, here's how to build it:
  1. Create the database. It's two tables, hours and projects:
    CREATE TABLE time_hours (
    	sessionID int IDENTITY (1, 1) NOT NULL ,
    	projectID int NULL ,
    	startTime datetime NULL ,
    	endTime datetime NULL ,
    	Notes varchar (255) NULL 
    )
    
    CREATE TABLE time_projects (
    	projectID int IDENTITY (1, 1) NOT NULL ,
    	projectName varchar (50) NULL ,
    	projectRate int NULL 
    )
  2. Grab this script: trackhours.asp (Change extension to .asp.)
  3. Add your database details to the top of the script.
  4. Open the script at your server in a web browser, create a project, click Start Timing.
I can add notes to every session, and then go back and edit those notes by clicking on them once the session is finished. (Handy for noting what I actually did vs. what I set out to do.) I can create a new project by choosing "Create New Project" from the drop-down, which gives me a few extra form fields for project name and hourly rate. There's no way to delete a project, but I haven't needed that yet. There's just one session open at a time, and when I'm done working I just click the big red button and that session is added to the top of the list. There's a list at the bottom of the page showing the last 20 sessions or so. In action the script looks like this:

TrackHours screenshot
starting a session

TrackHours screenshot
session in progress

(The data has been garbled to protect the innocent.)

I figured someone else out there might not want to burn the few hours it takes to put this together. I've been using this script for just over a month, and so far it's fantastic. I have a running log of how I've been spending my days, and an estimate of how much I'm making during the week. I'm finally feeling organized when it comes to tracking hours. And since I've been freelancing for about five years, it's about time.