Description: If you use DATEDIF between 2 dates (including hours), the rounding must be a ceil rounding LibreOffice does a floor rounding. Steps to Reproduce: 1. A1="01/01/2017 08:00:00" 2. A2="03/01/2017 07:00:00" 3. B2=DATEDIF(A2;A3;"d") Actual Results: 1 Expected Results: 2 Reproducible: Always User Profile Reset: No Additional Info: User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 OPR/42.0.0.239320787 (Edition EXP62)
From the help, https://help.libreoffice.org/Calc/DATEDIF " DATEDIF This function returns the number of whole days, months or years between Start *********** date and End date. " even ODF 1.2 it's not explicit about that. http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.html#__RefHeading__1018176_715980110 If hours are not given then result it's as you expect. With =DATEDIF(INT(A1);INT(A2);"d") the decimal part (time) of A1 and A2 it's eliminated Sounds reasonable to me how it works, providing hours then there are taked for the calculation.
Forgot to specify that Excel and WPS gives the right result. This leads to *critical* compatibility problem between LO and Excel macros
I guess you mean functions not macros.
I confirm that this is a bug. The wording is quite clear: the difference between *dates*. This doesn't tell about difference between moments in time. We have a data type that combines both date *and* time into a single floating-point number. But that doesn't mean that this makes term "date" to magically equal to term "datetime". If we use, e.g., function =DATEVALUE("01/01/2017 08:00:00"), then it gives 42736 (without fractional part). So, the DATEDIF must be equal to DATEVALUE(date1)-DATEVALUE(date2).
(1) https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=4e71be498903dee5bf719a73f4976bb5356335dd (2) https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=40c8170c5281cd7b19313a79f902ef9715351c9f On both commits dates variables are defined as: double nDate2 = GetDouble(); double nDate1 = GetDouble(); and days are calculate (1) int dd = nDate2 - nDate1; (2) long dd = nDate2 - nDate1;
Calc normally converts floating point values (like datetime) to integer values (like date) by 'floor rounding'. In this case, as indicated in comment #5, it doesn't. I'll fix that.
Winfried Donkers committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=e7606f1f19b2970f0160075f56d4d97029f1e47a tdf#105548 fix incorrect DATEDIF result. It will be available in 5.4.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Winfried Donkers committed a patch related to this issue. It has been pushed to "libreoffice-5-3": http://cgit.freedesktop.org/libreoffice/core/commit/?id=4b605ca21b15ff4cbd734291e21ab02c5e57c424&h=libreoffice-5-3 tdf#105548 fix incorrect DATEDIF result. It will be available in 5.3.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Tested Version: 5.4.0.0.alpha0+ Build ID: 2670ca3fc597decae78499d1397539668eb84e5e CPU Threads: 4; OS Version: Windows 6.19; UI Render: default; TinderBox: Win-x86@42, Branch:master, Time: 2017-01-31_05:32:46 Locale: es-ES (es_ES); Calc: CL Thanks Winfried.
Thank you Winfried! Zdeněk, is this worth to be added to a test sheet?
Oh sorry! I didn't look at the commit itself - it is already done! Sorry - and thanks again Winfried!
Hi. I fought behavior was the right. I put, purpose of testing, in B1, "03/01/2017 07:59:56" and it goes on with "1" result until 48 hours achieved; I reiterate, I think it is what I fought was the correct. But, it was fixed and it is what counts (no pun of words). Congrats for all involved in solving (and in pointing it too).