Bug 88285 - Time calculation across midnight or more days is wrong with use of time stamp ctrl+shift*:
Summary: Time calculation across midnight or more days is wrong with use of time stamp...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.3.5.2 release
Hardware: Other Windows (All)
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-11 06:02 UTC by bugquestcontri
Modified: 2015-01-16 01:15 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
sample counting with time (8.84 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-01-14 14:48 UTC, Cor Nouws
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bugquestcontri 2015-01-11 06:02:57 UTC

    
Comment 1 bugquestcontri 2015-01-11 06:04:40 UTC
When calculating a time difference across midnight the result is negative
Comment 2 bugquestcontri 2015-01-11 06:13:28 UTC
Observation:
When entering in cell A1 the actual time stamp with ctrl+shift+; doing the same when the time wents at least 1 time across midnight and enter the then actual time stamp again with ctrl;shift+; into cell B!, the content of cell C1 with the formula =B1-C1 is wrong by -24h for 1 midnight crossing. 

As this was correct when I used 4.2 versions I compared 4.2.6 portable with 4.3.5.2 normal installation and found the the time stamp in both versions is different.

4,2 version 
time stamp: mm/dd/yy hh:mm:ss thus carrying the day information as well

4.3
time stamp: hh:mm:ss only no day information included. This causes the calculation error

Expectation: 
Correct the time stamp ctrl+shift*: that day information is included again.
Comment 3 bugquestcontri 2015-01-11 06:31:55 UTC
Correction of comment 2: 

Formula in C1 should be =B1-A1
Comment 4 Urmas 2015-01-11 18:27:02 UTC
That's consistent with Excel behavior. Previous one was a bug.
Comment 5 Cor Nouws 2015-01-11 20:50:57 UTC
thanks for checking Urmas.
You mean that an inserted time stamp is without day info?

(Of course there is a good possibility to count with times by using appropriate cell formatting etc.)
Comment 6 bugquestcontri 2015-01-14 10:19:24 UTC
I tried different format settings but the calculation across midnight is always wrong in 4.3. 

It is indeed consistent with Excel where ctr+: inserts the actual time without a date information. In Excel I cannot calculate a time difference across midnight as well. At least I did not find a solution. As I cannot calculate across midnight I regard Excel as faulty.

How can we enter times in Calc (beside manually enter the information yy/mm/dd hh:mm:ss) and calculate across midnight?

Can we have a function to enter the "current date & current time" and allocate a shortcut key to it (eg. ctr+:)? Then we would be consistent with (poor Excel) and have an additional feature compared to Excel.

I re-opend the bug because I would like to get an answer to my question.
Comment 7 raal 2015-01-14 12:07:06 UTC
(In reply to bugquestcontri from comment #6)
> I tried different format settings but the calculation across midnight is
> always wrong in 4.3. 
> 
> It is indeed consistent with Excel where ctr+: inserts the actual time
> without a date information. In Excel I cannot calculate a time difference
> across midnight as well. At least I did not find a solution. As I cannot
> calculate across midnight I regard Excel as faulty.
> 
> How can we enter times in Calc (beside manually enter the information
> yy/mm/dd hh:mm:ss) and calculate across midnight?
> 
> Can we have a function to enter the "current date & current time" and
> allocate a shortcut key to it (eg. ctr+:)? Then we would be consistent with
> (poor Excel) and have an additional feature compared to Excel.
> 
> I re-opend the bug because I would like to get an answer to my question.

Hello.
You can press CTRL+; (this insert DATE) and then on the same cell press CTRL+SHIFT+; (this insert TIME) -> result is date with time.
Example:
 CTRL+; (14.01.2015) & CTRL+SHIFT+;     ->  result is 14.01.15 13:01

I'll close this as notabug. Maybe this can be enhancement "create shortcut for insert date&time".
Comment 8 Cor Nouws 2015-01-14 14:48:13 UTC
Created attachment 112220 [details]
sample counting with time

see the sample for how it works for me
Comment 9 bugquestcontri 2015-01-16 01:15:04 UTC
@ raal and @Cor Nouws - Thanks for the solution and the sample. This works on my XP machine. Hope I can make this to small macro. 

Should I have a bit time I will place an enhancement request for an additional  combined entry of current date & current time. 

BTW, just as side note I might most likely file a bug report for a wrong function in v 4.3.5.2 on a Linux kubuntu 14.04 LTS machine. Need to check details again. If I can confirm what I saw I the bug report will be a separate one.