# Date Time and SQL

**URL:** <https://forum.inductiveautomation.com/t/date-time-and-sql/3858>\
**Category:** Ignition\
**Created:** [January 13, 2012, 9:51pm UTC](https://forum.inductiveautomation.com/t/date-time-and-sql/3858 "2012-01-13T21:51:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WildeKurt](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@WildeKurt](https://forum.inductiveautomation.com/u/WildeKurt)\
**Post date:** [January 13, 2012, 9:51pm UTC](https://forum.inductiveautomation.com/t/date-time-and-sql/3858/1 "2012-01-13T21:51:33Z")

</div>

I’ve defined the following script:

`def logEventGlobal (msg):
	import system
	# Logs an event to the LogGlobal database...
	from java.util import Date
	currentDate = Date()
	curDateStr = system.db.dateFormat(currentDate,"yyyy-MM-dd H:mm:ss")
	rowCnt = system.db.runUpdateQuery("INSERT INTO LogGlobal (MessageDateTime, MessageText,Source) VALUES('" + curDateStr + "','" + msg + "','Ignition')")`

It works fine except for the MessageDateTime column I only get the date in the database. The time is always ‘00:00:00.’ Where is my time going?

---

<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:** [January 13, 2012, 10:26pm UTC](https://forum.inductiveautomation.com/t/date-time-and-sql/3858/2 "2012-01-13T22:26:30Z")

</div>

What is the data type of the MessageDateTime column in the database? I bet it is just a date and not a datetime.
