# Datetime Format Character Issue

**URL:** <https://forum.inductiveautomation.com/t/datetime-format-character-issue/1833>\
**Category:** Ignition\
**Created:** [May 10, 2010, 7:51pm UTC](https://forum.inductiveautomation.com/t/datetime-format-character-issue/1833 "2010-05-10T19:51:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Garrickr](https://avatars.discourse-cdn.com/v4/letter/g/4491bb/32.png) [@Garrickr](https://forum.inductiveautomation.com/u/Garrickr)\
**Post date:** [May 10, 2010, 7:51pm UTC](https://forum.inductiveautomation.com/t/datetime-format-character-issue/1833/1 "2010-05-10T19:51:17Z")

</div>

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?

thanks

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [May 10, 2010, 7:57pm UTC](https://forum.inductiveautomation.com/t/datetime-format-character-issue/1833/2 "2010-05-10T19:57:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Garrickr](https://avatars.discourse-cdn.com/v4/letter/g/4491bb/32.png) [@Garrickr](https://forum.inductiveautomation.com/u/Garrickr)\
**Post date:** [May 10, 2010, 8:24pm UTC](https://forum.inductiveautomation.com/t/datetime-format-character-issue/1833/3 "2010-05-10T20:24:04Z")

</div>

thanks! that was it.
