How does one add minutes to a timestamp attribute?
How does one add seconds to a timestamp attribute?
Minute and Second calculations?
-
- Posts: 619
- Joined: Wed Jun 17, 2015 11:16 pm
- Location: Omaha, Nebraska
- Contact:
Minute and Second calculations?
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
We specialize in enabling business through the innovative use of technology.
AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
Re: Minute and Second calculations?
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.
Also For seconds in the db, make sure its not small datetime type... which appears to be what aware does by default.
-
- Posts: 619
- Joined: Wed Jun 17, 2015 11:16 pm
- Location: Omaha, Nebraska
- Contact:
Re: Minute and Second calculations?
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.
-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
We specialize in enabling business through the innovative use of technology.
AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
Re: Minute and Second calculations?
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?
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 (30.16 KiB) Viewed 10796 times
-
- Posts: 619
- Joined: Wed Jun 17, 2015 11:16 pm
- Location: Omaha, Nebraska
- Contact:
Re: Minute and Second calculations?
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
We specialize in enabling business through the innovative use of technology.
AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
Re: Minute and Second calculations?
Unfortunately the work around might be to have the time component as a separate field.
-
- Posts: 619
- Joined: Wed Jun 17, 2015 11:16 pm
- Location: Omaha, Nebraska
- Contact:
Re: Minute and Second calculations?
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)
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
We specialize in enabling business through the innovative use of technology.
AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
Re: Minute and Second calculations?
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
Hopefully support will give us the answer... or a fix
-
- Posts: 7525
- Joined: Sun Apr 24, 2005 12:36 am
- Contact:
Re: Minute and Second calculations?
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
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
Re: Minute and Second calculations?
BTW, in case some might get confused about the "//". support was using the // as if he was writing java code and making comments using //.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