# Alleged date time conversion error, SQL Server to Ignition

**URL:** <https://forum.inductiveautomation.com/t/alleged-date-time-conversion-error-sql-server-to-ignition/93995>\
**Category:** Ignition\
**Created:** [July 31, 2024, 5:55pm UTC](https://forum.inductiveautomation.com/t/alleged-date-time-conversion-error-sql-server-to-ignition/93995 "2024-07-31T17:55:23Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [July 31, 2024, 10:47pm UTC](https://forum.inductiveautomation.com/t/alleged-date-time-conversion-error-sql-server-to-ignition/93995/8 "2024-07-31T22:47:51Z")

</div>

Well, updating the driver did not work.  
This, is the query and passing `now()`.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/f/2f951f162fd582bb7a4cd40d2c90027617d609c1.png)

The error is the datetime2 conversion I mentioned earlier. The binding for `this.custom.now` is this: `dateFormat(now(), 'yyyy/MM/dd hh:mm:ss')`.

The commented datetime in the `Value` field was a successful test.

Using the Scripting Tool, `system.date.now()` is a java.util.date object. If I print that out, I get: `Wed Jul 31 15:34:05 PDT 2024 `.  
If I send that to the SAME query used in the binding, I get the expected integer returned!

I am missing something here in the expression language versus Jython. A simple cast, convert, format???

I found this thread:

> [@Perspective date time input - Can you add an option for current datetime?](https://forum.inductiveautomation.com/t/perspective-date-time-input-can-you-add-an-option-for-current-datetime/75415/3):
>
> This seems to work: def runAction(self): date = system.date.now() self.props.value = system.date.setTime(system.date.now(),system.date.getHour24(date),system.date.getMinute(date),0)

Not sure how Transistor's code worked with the 0 in the `now(0)`. I kept getting errors. So I adapted r123's code to fit my widget, removed the binding on `this.custom.now` and that seems to work.  
I just don't understand why `now()` will not work in an expression binding for a named query `datetime` parameter, but `system.date.now()` will.

---

_[View the full topic](https://forum.inductiveautomation.com/t/alleged-date-time-conversion-error-sql-server-to-ignition/93995)._
