Add 30 days to time/date stamp

hackj0632

Member
Join Date
Jul 2009
Location
wi
Posts
33
Im using studio 5000 for a project and have a string that contains the date. I was wondering if someone as figued out how to get a new target date with veriable input of a future date offset.

Exmple 8/17/15 want to determine the date 30 days from now, so enter 30 days in and get 9/16/15.

I was thinking of dividing by seven and geting the week offset and adding the days after that. also would have to account for year rollover and month rollover.

Not sure of the best way to approach this problem.

Thank you!
 
There is a set of Add-On Instructions on the RA Sample Code website that might suit your needs if you can get the Date/Time into a set of DINT's that represent the elements of the WallClock; Year, Month, Day, Hour, Minute, Second, microsecond.

The AOI called "T_ADD" allows you to add one DateTime to another DateTime and get a resultant DateTime.

Your second DateTime would be all zeroes except a 30 in the Day field, I think.

I don't have a CPU handy to test this, but have a look and see if it does what you want. On the RA Sample Code website, use the keywords "Time and Date" to search for this pack of AOIs.
 

Similar Topics

Hi, I have questions. I have Analog Input that need to put into Ignition Designer. But I don't know how to put?
Replies
1
Views
107
I have just installed Studio 5000 V30.11 on my Windows 11 Pro machine. First I had an "Invalid Pointer" error that required me to update Factory...
Replies
2
Views
113
Im trying to create a level indicator for water Tank i have used the ADD function while the pump is on and level increasing everything works...
Replies
33
Views
1,014
We are trying to poll data coming from a PLC for remote monitoring we have the IP address of the PLC and the default port number and the path is...
Replies
25
Views
561
Back
Top Bottom