Datetime Format Character Issue

I have a question about format characters. I am trying to log maintenance issues using a start and end time for down time coordination. I am trying run the following query, and I know the problem is in my datetime format character.

system.db.runUpdateQuery(“INSERT INTO Maint_Comment (UserID, st_stamp, et_stamp, IssueID, NoteTxt, Stick) VALUES (’%s’, ‘%s’, ‘%s’, 1, ‘%s’, 0)”%(queryValue1,queryValue2,queryValue3,queryValue))

where queryValue2 and queryValue3 are linked to popup calendar dates:

queryValue2 = event.source.parent.getComponent(‘Start_Time’).date#system.tag.getTagValue(’[Client]Start_Time’)
queryValue3 = event.source.parent.getComponent(‘End_Time’).date#system.tag.getTagValue(’[Client]End_Time’)

Is there a format character for datetime or am I stuck using an integer to display number of seconds since 1970 and converting for display purposes?


You have to format the date before you bring it into scripting. So, create a string dynamic property on the Start_Time and End_Time components that are bound to an expression using the date format function. Bring those into the script instead of the date property. Hope this helps.

thanks! that was it.