# Timestamp in Event Handler

**URL:** <https://forum.inductiveautomation.com/t/timestamp-in-event-handler/3050>\
**Category:** Ignition\
**Created:** [June 30, 2011, 1:37pm UTC](https://forum.inductiveautomation.com/t/timestamp-in-event-handler/3050 "2011-06-30T13:37:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![k\_breath](https://avatars.discourse-cdn.com/v4/letter/k/eada6e/32.png) [@k\_breath](https://forum.inductiveautomation.com/u/k_breath)\
**Post date:** [June 30, 2011, 1:37pm UTC](https://forum.inductiveautomation.com/t/timestamp-in-event-handler/3050/1 "2011-06-30T13:37:40Z")

</div>

I want to create a time stamp everytime a button is clicked. I’m currently trying to do this via code in the event handler section, but can’t figure out what the code should look like. Here is what I have :  
system.db.runUpdateQuery("Insert INTO endrun\_tstamp(‘stampTime’) Value (“t\_stamp”))

I’m using my MySQL for a database. Is “system.db.runUpdateQuery” correct for inputting new items into a database?

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:** [June 30, 2011, 3:02pm UTC](https://forum.inductiveautomation.com/t/timestamp-in-event-handler/3050/2 "2011-06-30T15:02:43Z")

</div>

Yes, system.db.runUpdateQuery can be used to insert values into the database. However, you query should look like the following:`system.db.runUpdateQuery("INSERT INTO endrun_tstamp (stampTime) VALUES (CURRENT_TIMESTAMP)")`Let us know if you have any other questions.
