I see the option to add days or hours, but what about if I need to add minutes? Can that be done?
Thanks
Bruce
Can I add Minutes to TimeStamp?
Re: Can I add Minutes to TimeStamp?
I would convert minutes to hours. I don't think the minutes function exists.
-
- Posts: 1252
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Can I add Minutes to TimeStamp?
To convert minutes to hours use fractions.
example:
TIME_ADD('2022-06-23 08:30:00', 0.50)
returns '2022-06-23 09:00:00'
Note: I think it was fixed several builds back, but there was a time when subtracting fractions (-0.50) did not work.
Bob
Re: Can I add Minutes to TimeStamp?
There has been a few times I wish there was a START_OF_DAY (similar to START_OF_WEEK) that returned a timestamp with HOURS, MINUTES and SECONDS all set to 00PointsWell wrote: ↑Thu Jun 23, 2022 6:03 am The whole area of Time is inconsistently managed.
There's no WEEK_ADD or YEAR_ADD either.
Bob
Re: Can I add Minutes to TimeStamp?
The problem with Fraction hours is that if I want to add 17 minutes, i get a repeating fraction. Wonder how hard it would be for Vlad to add MinuteAdd???
Bruce
Bruce
-
- Posts: 1252
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Can I add Minutes to TimeStamp?
It would be relatively trivial in that it is functionality contained within commons-lang3 jar and not something being written from scratch.
There is a lot of functionality that exists within the shipped JARs that has not been exposed for example
commons-validator
There is a lot of functionality that exists within the shipped JARs that has not been exposed for example
commons-validator
- EAN Validator - checks a barcode is compliant (+additional specialist applications such as ISBN)
- ABA Validator - checks a routing number is compliant
- LUHN Validator - checks a credit card number is compliant
-
- Posts: 7410
- Joined: Sun Apr 24, 2005 12:36 am
- Contact:
Re: Can I add Minutes to TimeStamp?
17 min of an hour is 17/60 = 0,2833333333....
If you round to the closest value that is bigger than the period (0.2834) you will get what you want.
If you round to the closest value that is bigger than the period (0.2834) you will get what you want.
Aware IM Support Team