SQL Query Issue

I am using the following SQL query to query data between a certain set of dates:

SELECT source, eventtime
FROM alarm_events
WHERE eventtime BETWEEN Mon Jul 06 09:22:08 CDT 2015 and Mon Jul 06 09:22:18 CDT 2015

I keep getting an error and I know that it is in the third line. Is the date format going to present an issue between my SQL DB and my ignition platform? Or maybe a better question is what format should my date be in for this to work?

I would like to be able to tie the begin date and end date to a date selector on the screen that I am using, but am not sure it is possible considering the format differences between the two programs.

Thanks in advance for the help! :smiley:

You can certainly reference a date range slider in your query. That would be the best thing to do anyhow. You don’t want the dates to be hard coded. You could have a query that resembles

SELECT source, eventtime FROM alarm_events WHERE eventtime BETWEEN '{Root Container.Date Range.startDate}' AND '{Root Container.Date Range.endDate}'

Your query would probably work if you placed quotes around the dates. But making the date adjustable would be preferred in the end.

Thanks Greg! I needed the quotation marks! I had tried indirect binding the first time, but did not use the quotation marks. That’s awesome! :smiley: :smiley: :smiley: