I have an org-table for my timesheets. Part of it looks this:
| Start | End | End - Start | | <2020-03-05 10:00> | <2020-03-05 Thu 14:30> | 0.1875 | #+TBLFM: $3=$2-$1
How can I get that "0.1875" to turn into "4:30"?
(Spac)emacs/calc/org-mode has undestood that they are dates (org-toggle-time-stamp-overlays works on them and the colours change). Perhaps this is the
algorithm generally “does the right thing”
And the subtraction is correct (24 hours * 0.1875 = 4.5 hours)
But it gives me the duration as a decimal number of a 24 hour day, as per
Subtracting two date forms computes the number of days between them (represented as a simple number)
"floor($3*24)to get just the hours, and then separate out the minutes, get the result into the same cell, perhaps even with the formatting I want. Ugly, and seems unnecessary. The software already has some understanding of dates
time($2-$1)- I just happened to try this right before starting to write this post.
floorhad worked, so why not?
| Start | End | time(End - Start) |
| <2020-03-05 10:00> | <2020-03-05 Thu 14:30> | 4@ 30' 0" |
time is one of the functions from the Index of Algebraic Functions
Now in HMS Forms, it says
Display format for HMS forms is quite flexible. See HMS Formats
The [(calc-hms-notation)] command controls the display of HMS (hours-minutes-seconds) forms. It prompts for a string which consists basically of an “hours” marker, optional punctuation, a “minutes” marker, more optional punctuation, and a “seconds” marker. Punctuation is zero or more spaces, commas, or semicolons. The hours marker is one or more non-punctuation characters. The minutes and seconds markers must be single non-punctuation characters.
But entering these seems to have no effect. I've tried
hms No change
h;m;s No change
hh, mm, ss which gives error "Bad hours-minutes-seconds format"
hh;mm;ss which also does, so maybe it's the double h
h;mm;ss this one too, so maybe it's the double anything
No changes at all, which makes me think I've messed up somewhere else. I've restarted Spacemacs as well, and that didn't help.
It seems to me that I should not use org-mode's Durations and time values, because
Input duration values must be of the form ‘HH:MM[:SS]’
and I want time and date to be in the same cell. I sometimes work past midnight
Table formula for dates delta is similar. I'd say this question is different in that I ask whether HH:MM is possible without an extra day-column, and without editing (spac)emacs' config.