Re: [libreoffice-users] Calculating the difference between two time values by means of SQL

2021-03-08 Thread Markus Elfring
> You are looking for the function DATEDIFF(string, datetime1, datetime2)

Thanks for your information.

I got distracted by the key word “DATE” while I was looking for the support of
an other time unit.
An SQL statement like the following can fit to my application needs.

SELECT "day", "start", "stop",
   DATEDIFF( 'minute', "start", "stop" ) / 60.000 AS "duration"
FROM "time_measurements";


Will any adjustments become more helpful also for the software documentation?

Regards,
Markus

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy


Re: [libreoffice-users] Calculating the difference between two time values by means of SQL

2021-03-05 Thread Robert Großkopf
Hi,
> 
> 
> SELECT ID, t1, t2, t2 - t1 AS duration FROM time_measurements1

You are looking for the function DATEDIFF(string, datetime1, datetime2)
Could be this works, if you have choosen a datetime field, not only a
time field.
SELECT ID, t1, t2, DATEDIFF('hour', t1, t2) AS duration FROM
time_measurements1
> 
> Would you like to point further information sources out besides query examples
> which work with dates and time stamps?
You are German, right?
have a look at "Base Handbuch" and also "Base Beispiele". In "Base
Beispiele" is an example für getting times for running or something like
this.

Regards

Robert
-- 
Homepage: https://www.familiegrosskopf.de/robert


-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy


Re: [libreoffice-users] Calculating the difference between two time values by means of SQL

2021-03-05 Thread Drew Jensen
Howdy,

The salient point here is the version of HSQLdb which comes with
LibreOffice is rather old and lacking when it comes to date
manipulation, but it can be done and hopefully this post over at ASK
dot LibreOfffice will help answer you question:
 
https://ask.libreoffice.org/en/question/75480/how-to-do-basic-arithmatic-with-dates-in-libre-base-queries/

best wishes,

Drew

On Thu, Mar 4, 2021 at 9:04 AM Markus Elfring  wrote:
>
> Hello,
>
> Two columns of a table (for the database engine “HyperSQL” within the 
> application
> “LibreOffice Base 7.1.0.3-985.1”) have got the data type “TIME”.
> I would like to compute a difference for these fields.
>
> It seems that the following SQL statement is insufficient so far.
>
> SELECT ID, t1, t2, t2 - t1 AS duration FROM time_measurements1
>
>
> I would appreciate your advices.
>
> Would you like to point further information sources out besides query examples
> which work with dates and time stamps?
>
> Regards,
> Markus
>
> --
> To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
> Problems? 
> https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
> Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
> List archive: https://listarchives.libreoffice.org/global/users/
> Privacy Policy: https://www.documentfoundation.org/privacy

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy


[libreoffice-users] Calculating the difference between two time values by means of SQL

2021-03-04 Thread Markus Elfring
Hello,

Two columns of a table (for the database engine “HyperSQL” within the 
application
“LibreOffice Base 7.1.0.3-985.1”) have got the data type “TIME”.
I would like to compute a difference for these fields.

It seems that the following SQL statement is insufficient so far.

SELECT ID, t1, t2, t2 - t1 AS duration FROM time_measurements1


I would appreciate your advices.

Would you like to point further information sources out besides query examples
which work with dates and time stamps?

Regards,
Markus

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy