Issue 124620 - Doing math useing value of NOW()
Summary: Doing math useing value of NOW()
Status: CLOSED NOT_AN_OOO_ISSUE
Alias: None
Product: Calc
Classification: Application
Component: programming (show other issues)
Version: 4.0.1
Hardware: PC All
: P3 Minor (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords: needmoreinfo
Depends on:
Blocks:
 
Reported: 2014-04-07 19:38 UTC by Robert Hays
Modified: 2017-05-20 09:55 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: 4.1.0-dev
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Robert Hays 2014-04-07 19:38:17 UTC
You can multiply (*) and divide (/) the output of NOW() but you cannot add (+) or subtract(-) to or from it.

Robert Hays
rhays@galvestonbay.net
Comment 1 Edwin Sharp 2014-04-07 20:21:06 UTC
multiply uses datevalue
divide uses datevalue
add adds to days
subtract removes days

AOO410m14(Build:9760)  -  Rev. 1585331
2014-04-07_04:11:07 - Rev. 1585379
Debian
Comment 2 mroe 2014-04-08 07:40:16 UTC
> multiply uses datevalue
> divide uses datevalue

The result of multiply or divide a date would never be a senseful date.

> add adds to days
> subtract removes days

Yes, if you add/subtract integers > 0.
Adding/subtracting Values 0 < x < 1 change the time.

(If you doing this in one formula like =NOW()+2 you have to format the cell with a date format.)

This is the right defined behaviour. Where is the DEFECT?
Comment 3 Edwin Sharp 2014-04-08 08:28:19 UTC
Bug 1: No error message for what you call "never be a senseful date".
Bug 2: No documented help for what you call "right defined behaviour".

IMHO all four operations should result in error message.
Now()+integer -> increase day ?
Now()+decimal -> increase time ?
"Assumption is the mother of all fuckups" :)
Comment 4 Robert Hays 2014-04-08 08:38:39 UTC
Your response to this issue is extreamly disappointing, to me it is a fault and always will be.  When one cannot get the spread sheet to do ALL the math he needs doing then he just might as well do it with pencil & paper in the first place.
Just one of the ways I was trying to use it is:
I have a crop planted that is 45% ready to harvest, this would calcu. out to X# of hours left, by adding this x# of hours to NOW() I would have the exact time of day I would need to go harvest it, but this is not to be ,,,,, so sad.
Sorry to have bothered you guys with this.

Robert
Comment 5 Edwin Sharp 2014-04-08 08:47:40 UTC
Is your desired calculation successful with an older version of OpenOffice or a different spreadsheet program ?
Comment 6 mroe 2014-04-08 08:55:27 UTC
(In reply to Robert Hays from comment #4)
> Just one of the ways I was trying to use it is:
> I have a crop planted that is 45% ready to harvest, this would calcu. out to
> X# of hours left, by adding this x# of hours to NOW() I would have the exact
> time of day I would need to go harvest it, but this is not to be ,,,,, so
> sad.
> Sorry to have bothered you guys with this.


You have to look how a spreadsheet is working.

Let in cell B1 you X# hours.

So you have simply to calculate:
=NOW()+B1/24  -  because 1 day = 24 hours

Format the cell with "DD/MM/YYYY HH:MM:SS".
Comment 7 Edwin Sharp 2014-04-08 09:17:06 UTC
reopened
Comment 8 Robert Hays 2014-04-09 06:23:42 UTC
(In reply to Edwin Sharp from comment #7)
> reopened

The more I ponder on this issue the more I realize that what I was trying to do is just not practical, mainly because of fractions and there is no format for Hours.  There is a format for DAYS & TIME but not for Hours, minutes or seconds.

Your suggestion:  did the trick with the added benefit of the date.
Let in cell B1 you X# hours.

So you have simply to calculate:
=NOW()+B1/24  -  because 1 day = 24 hours

Format the cell with "DD/MM/YYYY HH:MM:SS".

Thanks ever so much for the help, maybe some day someone will add a format for HOURS just for the hell of it.

Robert (Bob)
Comment 9 Robert Hays 2014-04-09 06:25:04 UTC
(In reply to Edwin Sharp from comment #7)
> reopened

The more I ponder on this issue the more I realize that what I was trying to do is just not practical, mainly because of fractions and there is no format for Hours.  There is a format for DAYS & TIME but not for Hours, minutes or seconds.

Your suggestion:  did the trick with the added benefit of the date.
Let in cell B1 you X# hours.

So you have simply to calculate:
=NOW()+B1/24  -  because 1 day = 24 hours

Format the cell with "DD/MM/YYYY HH:MM:SS".

Thanks ever so much for the help, maybe some day someone will add a format for HOURS just for the hell of it.

Robert (Bob)
Comment 10 Edwin Sharp 2014-04-09 07:00:11 UTC
With all due respect, I just don't understand you.
In comment 0 you talk about multiply and divide.
In comment 4 you talk about hours addition.
In comment 8 you talk about hours format.

Next time, please discuss at:
https://forum.openoffice.org/en/forum/index.php
Please report issues here after reading:
https://wiki.openoffice.org/wiki/QA/HowToFileIssue
Comment 11 Robert Hays 2014-04-09 08:20:06 UTC
Well crap, at 83 yr.'s I should be entitled to a little bit of confusion. <G>
As far as I am concerned the issue is resolved, over and done with.

Thanks
Bob
Comment 12 Edwin Sharp 2014-04-09 08:23:43 UTC
I think error messages and better help are appropriate, but you are the boss :)