Minute and Second calculations?

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
johntalbott
Posts: 619
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, Nebraska
Contact:

Minute and Second calculations?

Post by johntalbott »

How does one add minutes to a timestamp attribute?


How does one add seconds to a timestamp attribute?
VocalDay Solutions - Agility - Predictability - Quality

We specialize in enabling business through the innovative use of technology.

AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
CalD
Posts: 146
Joined: Sun May 08, 2016 10:20 pm

Re: Minute and Second calculations?

Post by CalD »

Not at my computer to double check but from memory I think you can do date_add, which adds days, divide it down to the minutes/seconds you want.
Also For seconds in the db, make sure its not small datetime type... which appears to be what aware does by default.
johntalbott
Posts: 619
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, Nebraska
Contact:

Re: Minute and Second calculations?

Post by johntalbott »

Thanks CalD.

-Both attributes are TimeStamps in AwareIM
-Both the columns in the database are set to DateTime to support seconds

Maybe a specific scenario will help?

BO.StartDate = 7/1/2016 12:00:00 AM

Using the StartDate ... I need to add 6 days, 11 hours, 59 minutes, 59 seconds to calculate the Due Date

BO.DueDate = 7/7/2016 11:59:59 PM

I've been trying different approaches with DATE_ADD and TIME_ADD, but can't get all the way there.
VocalDay Solutions - Agility - Predictability - Quality

We specialize in enabling business through the innovative use of technology.

AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
CalD
Posts: 146
Joined: Sun May 08, 2016 10:20 pm

Re: Minute and Second calculations?

Post by CalD »

Hi John,

I just had a quick try at this as your scenario is a little different to what I had done in the past - but can see that I will need to do it at some point for sure!

I can get it to work to minutes but not to seconds, it is like AIM isn't liking dealing with seconds on timestamp fields. In the past I have done it to seconds just on Time fields.

What I have done is attached: from top down - adding days, then hours, then minutes, then seconds (doesn't work) but should?
Attachments
DateTime.png
DateTime.png (30.16 KiB) Viewed 10796 times
johntalbott
Posts: 619
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, Nebraska
Contact:

Re: Minute and Second calculations?

Post by johntalbott »

This the same as what I'm running into. I can't come up with a solution for seconds.
VocalDay Solutions - Agility - Predictability - Quality

We specialize in enabling business through the innovative use of technology.

AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
CalD
Posts: 146
Joined: Sun May 08, 2016 10:20 pm

Re: Minute and Second calculations?

Post by CalD »

Unfortunately the work around might be to have the time component as a separate field.
johntalbott
Posts: 619
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, Nebraska
Contact:

Re: Minute and Second calculations?

Post by johntalbott »

I sure hope that is not the case.

btw .. for the sake of sharing different approaches ... I ended up with the below to handle days, hours, minutes all in one shot. I like the readability of the multiple steps approach you shared above as it a little easier to figure out what's going on.

ObjectiveActivity.DueDate = TIME_ADD(ObjectiveActivity.StartDate, 167.9833333333333333)
VocalDay Solutions - Agility - Predictability - Quality

We specialize in enabling business through the innovative use of technology.

AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
CalD
Posts: 146
Joined: Sun May 08, 2016 10:20 pm

Re: Minute and Second calculations?

Post by CalD »

I had the same as you initially :) broke it down to get a clearer picture.

Hopefully support will give us the answer... or a fix
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: Minute and Second calculations?

Post by aware_support »

You don't need to use the functions to add hours and minutes to a timestamp:

Object.Timestamp2 = Object.Timestamp1 + 1 // 1 hour difference
Object.Timestamp2 = Object.Timestamp1 + 1.5 // 1.5 hour difference

Seconds are not handled at the moment, but you can probably use the Duration attribute that supports seconds:
Object.Timestamp2 = Object.Timestamp1 + Object.Duration
Aware IM Support Team
BenHayat
Posts: 2749
Joined: Thu Dec 23, 2010 5:48 am
Location: Fla, USA
Contact:

Re: Minute and Second calculations?

Post by BenHayat »

aware_support wrote:You don't need to use the functions to add hours and minutes to a timestamp:

Object.Timestamp2 = Object.Timestamp1 + 1 // 1 hour difference
Object.Timestamp2 = Object.Timestamp1 + 1.5 // 1.5 hour difference

Seconds are not handled at the moment, but you can probably use the Duration attribute that supports seconds:
Object.Timestamp2 = Object.Timestamp1 + Object.Duration
BTW, in case some might get confused about the "//". support was using the // as if he was writing java code and making comments using //. :D
Post Reply