Marketcircle    Forums  Hop To Forum Categories  Billings  Hop To Forums  Using Billings    What is the format of createDate, startDateTime, and endDateTime in the SQLite file?
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Apprentice
Posted
Hi -

I want to quickly see how many hours I've "worked today". This doesn't seem possible from the reports. They all work on a slip. I want to work on the specific log entries of the slip (as they may span more than a day).

I can see the exact rows I want to look at in the sqlite database file.

For example my most recent entry looks like this:

timeEntryID = 819
modifyDate = 240781280.967395
createDate = 240781052.688945
startDateTime = 240781052.688945
endDateTime = 240781232.688945

What I can't figure out is how you are converting those numbers into dates. It's not a simple unix timestamp as that puts it back in 1977.

Can you please tell how those are storing dates so I can query on them to retrieve only those in the last 24 hours, etc.?

I understand I'm doing things I shouldn't be and I'll be careful. I promise smile

Thanks!
 
Posts: 6 | Registered: November 09, 2007Reply With QuoteEdit or Delete MessageReport This Post
RA
Apprentice
Posted Hide Post
I'm not looking at the details right now, but it's probably a NSDate or similar. If you use an object browser from F-Script you can see the types, and that sounds right to me.

You can do what you need inside the program though, without going to SQL directly. In F-Script for example, you can take two date values and add, subtract, and so on to get durations. Look inside the detailed time and flat billing report for an example of that, or grab my invoice I posted in the share forum and look at the code there ( which is fairly ugly and horrific in some ways since it was first time I'd done it, but does show the concept). In it I added a timesheet component to the invoice.
 
Posts: 12 | Registered: July 22, 2008Reply With QuoteEdit or Delete MessageReport This Post
Apprentice
Posted Hide Post
RA - You rock. It is an NSDAte. The critical part being it's the number of seconds since 1 January 2001, GMT.

So, with the below alias added to my bashrc I can type "billtime" and it will tell me how much I've billed today.

alias billtime="sqlite3 $HOME/Library/Application\ Support/Billings/Database/billings.bid \"select round(sum(endDateTime - startDateTime) / 60 / 60, 2) from TimeEntry where strftime
('%s', createDate + 978307200, 'unixepoch', 'localtime') > strftime('%s', 'now', 'localtime', 'start of day');\""

And I can add this to my crontab to notify me hourly how much I've managed to bill throughout the day.

(echo -n "You have billed "`billtime`" hours today.") | growlnotify -a Billings

Many thanks!
 
Posts: 6 | Registered: November 09, 2007Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

Marketcircle    Forums  Hop To Forum Categories  Billings  Hop To Forums  Using Billings    What is the format of createDate, startDateTime, and endDateTime in the SQLite file?

© Copyright 2006 Marketcircle Inc. All rights reserved.