I am trying to add a day when the shifts turns tomorrow. The current system has people put in the start and end time in a string format. I have it working up until I use timedelta(days=1).
I am trying to add a day when the shifts turns tomorrow.
Can you explain this more clearly? How does a shift "turn tomorrow"?
The current system has people put in the start and end time in a string format.
Why is it not entered in a date format? You should do everything date related in datetime data types and format it at the last possible moment prior to display.
And do not use jython's datetime module. At all. Use Ignition's provided system.date.* functions, or native java classes/methods that yield proper java.util.Date objects.
I would say too you don't even have to format in the tag. When you're displaying it via a binding or what have you, if its a component made to work with dates you have options there to modify how it looks, and you always have dateFormat - Ignition User Manual 8.1 - Ignition Documentation as a fallback.
Leave how you present the data on the presentation layer ie the vision window or perspective view.
One other benefit of using the system.date and java date objects is I se you are doing this
As long as you use system.date.* to make and use your dates, and then in your Named Queries define your parameters as DateTime objects, you do not have to worry about manually handling the stringing of the dates in SQL (thank god!). If you have made StartTime/EndTime as datetime parameters you could instead hypothetically do something like
Shift can be any set of hours the employees work. One Assembly line starts at 4:30pm and goes to 2:30pm. They would like to see hour counts between 4:30 and 5:30...
When you hit 11:30pm and go to 12:30am, we are into the next day within that hour/shift. Customer is always right
Unfortunately, this is Oracle and it did not like the datetime. I agree with SQL being much easier to utilize the DateTime format.
I could only get the queries to work from strings. I will give this a shot along with system.date, I could always just my shift UDT to give a full date and stop this date manipulation in the script.