Can I add Minutes to TimeStamp?

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
BLOMASKY
Posts: 1335
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Can I add Minutes to TimeStamp?

Post by BLOMASKY »

I see the option to add days or hours, but what about if I need to add minutes? Can that be done?


Thanks
Bruce
Rennur
Posts: 1181
Joined: Thu Mar 01, 2012 5:13 am
Location: Sydney, Australia

Re: Can I add Minutes to TimeStamp?

Post by Rennur »

I would convert minutes to hours. I don't think the minutes function exists.
PointsWell
Posts: 1252
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Can I add Minutes to TimeStamp?

Post by PointsWell »

The whole area of Time is inconsistently managed.

There's no WEEK_ADD or YEAR_ADD either.
BobK
Posts: 508
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: Can I add Minutes to TimeStamp?

Post by BobK »

Rennur wrote: Thu Jun 23, 2022 3:07 am I would convert minutes to hours. I don't think the minutes function exists.
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
BobK
Posts: 508
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: Can I add Minutes to TimeStamp?

Post by BobK »

PointsWell 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.
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 00
Bob
BLOMASKY
Posts: 1335
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: Can I add Minutes to TimeStamp?

Post by BLOMASKY »

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
PointsWell
Posts: 1252
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Can I add Minutes to TimeStamp?

Post by PointsWell »

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
  • 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
commons-codec is another one that contains really useful functions like Soundex (and its specialisations and derivatives) which would make searches more dynamic as it would pick up similarities rather than straight matches.
aware_support
Posts: 7410
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: Can I add Minutes to TimeStamp?

Post by aware_support »

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.
Aware IM Support Team
Post Reply