Working with Durations

Creating and using forms
Post Reply
LizPf
Posts: 7
Joined: Wed Mar 26, 2008 3:28 pm
Location: Northeast North America, Earth

Working with Durations

Post by LizPf »

My first post ... I'm using NeoOffice 2.2.3 on my Mac, OX 10.4.11

I've used database programs before, mostly FileMaker and 4th Dimension in the early 1990s. The database I'm creating now is my first in OOBase. It's an exercise log, where I can record the various exercises I do during the week, and derive statistics from the info.

One thing I don't see how to work with is time as duration — for example, if I go for a 2 mile walk and take 26 minutes, I don't need (or want) to record start and end times, just the 26 minutes.

Does anyone have any tips on this? {I can't believe no one else has run into this.} i'd like to do some calculations with the duration numbers, such as Total minutes this week, average speed (duration / miles), etc.

As I get further into this project, I know I'll have more questions on things like calculated fields, putting data from two tables on one form, etc., so if anyone can direct me to a good online reference (one that goes fairly deep into structure, but avoids SQL jargon), I would bother you guys far less.

Thanks!

--Liz
User avatar
Villeroy
Volunteer
Posts: 31346
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Working with Durations

Post by Villeroy »

If the status bar of your database main window shows "HSQLDB (embedded)" then the following documentation applies: http://hsqldb.org/web/hsqlDocsFrame.html
DocsFrame.html > SQL Syntax > DATEDIFF wrote: DATEDIFF(string, datetime1, datetime2)

returns the count of units of time elapsed from datetime1 to datetime2. The string indicates the unit of time and can have the following values 'ms'='millisecond', 'ss'='second','mi'='minute','hh'='hour', 'dd'='day', 'mm'='month', 'yy' = 'year'. Both the long and short form of the strings can be used.
Unfortunately there is still no built-in function to add/substract constants from a date/time (date +3 days, time +45 minutes).
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply