2018 Archives by date, by thread · List index

# Re: [libreoffice-users] Calculate difference between two dates time)

```=On 13 Jul 2018 at 15:11, Krunose wrote:

Subject:;Re: [libreoffice-users] Calculate difference
between two dates time)
To:;users@global.libreoffice.org
From:60;Krunosekruno.se@gmx.com
Date sent:60;Fri, 13 Jul 2018 15:11:58 +0200

12.07.2018 u 22:52, libreoffice-ml.mbourne@spamgourmet.com je napisao/la:
Krunose wrote:Hi,

just a quick question: if A1 holds 1.7.18. 15:30 and if A2 holds
1.7.18. 22:20, why then</span>

=3DTEXT((A2-A1);d:h:m)

indicate you're using a US locale...

2018-01-07 15:30:00 is represented internally as 43107.645833
2018-01-07 22:20:00 is represented internally as 43107.930556

Subtracting those numbers gives 0.284723, which represents the
date/time 1899-12-30 06:50:00

The day of month is 30, hence the 30 when that value is represented as
d:h:m.

Ah, I get it -- and I don't. If I want 0.284723 to be represented as
'd-h-m', why to treat it as date? Wouldn't it make sense to include a
function to LO Calc that could convert that number in desired format in,
just guessing, a text type.

So something like =TIMEPASSED(A1;d:m:s:ms) or
=TIMEPASSED(A1;YEARS-MONTHS-DAYS-HOURS-MINUTES-SECONDS) to get
0-0-0-6-50-0?

Seams not very complicated to add function like that...

Little bit complicated. If values of later items are smaller it gets more
complex.
=year(a2)-year(a1) would give years, but if month of a1mount a2
In just starting, this handles it for just the month being less, but day and other
values would also need to be worked for negative result.=YEAR(L14)-YEAR(L13)-(MONTH(L14)MONTH(L13))

Then you have the issue of different days in months, and leap years that change number of
days in February.

Thanks,

Kruno

--
To unsubscribe e-mail to: users+unsubscribe@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/

--
To unsubscribe e-mail to: users+unsubscribe@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/