I am using the easy chart and want to be able to set the start and end dates. I have tried several methods but keep getting errors. I obviously do not understand how dates are being used or whether it is a java date or python date.
What are the type of dates returned for the following:
client currentdatetime (tag)
now()
date range control
I am using the chart is historical mode but the startup range is not working.
Spookily I’m stuck doing exactly the same thing but with the Popup Calendar. Its ‘date’ property is in the form “12/08/2008 00:00:00 +0100” but I can’t seem to set it in code.
FactoryPMI Date properties are, technically, instances of java.util.Date. Expression language functions that return dates (like now()) are the same Dates. Queries that return SQL DATETIME or TIMESTAMP column types become Dates. Python dates are something different.
[quote=“TimE”]What are the type of dates returned for the following:
client currentdatetime (tag)
now()
date range control[/quote]
They are all the same - Dates.
Because otherwise you would have been trying to assign a String (the return type of dateFormat) to a Date, which isn’t valid.
It is by far easiest to initialize a popup calendar date using an expression or a polling-off query, but if you’re hell-bent on using scripting, its not too hard:
current time in python:
from java.util import Date
datePopup = event.source.parent.getComponent("DatePopup")
datePopup.date = Date()
Following on from this (bit of a delay I know ) I want to get today’s date as a string for inclusion in an SQL Update statement. I’ve come up with the following code:
from java.util import Calendar
today = Calendar.getInstance().getTime()
from java.text import SimpleDateFormat
todaysDate = SimpleDateFormat("yyyy-MM-dd").format(today)
print todaysDate
Is this the most straightforward way of doing this?
This system will have multiple users, so to guard against time on the view nodes being different, I thought it would be better to read all times and dates from the database server: