How to get rid of the miliseconds at the end of a date in Vision

I have a custom property that I want to use to reference a SQL store procedure. I keep getting a Date format error and the only thing I can see that is different from Perspective is the extra -0600 at the end of my date. How do I get rid of it. I have the expression the same in Perspective and it works just fine.

image
image

Blockquote
dateFormat(now(50000000), "yyyy-MM-dd HH:mm:ss")

The dateFormat expression returns a string, but the icon indicates that your custom property is a date datatype. Your exception depicts a SQL error, so perhaps you are passing the value into a SQL query as a string?

I recommend keeping the datatype as a date wherever possible. If you're using a named query or a prep query, a string conversion shouldn't be needed.

6 Likes

ahhh.. the syntax gremlin got me again... I needed to add ' ' to the variables for them to activate. I will get it one of these days.

I will also post the whole code I am working with next time. I can feel the Ignition code guys face palming themselves when they read this. :slight_smile:

So, still relying on string conversion of your timestamp. You will likely regret this.

Indeed.

3 Likes