# Reporting Module Date data type

**URL:** <https://forum.inductiveautomation.com/t/reporting-module-date-data-type/59333>\
**Category:** Ignition\
**Created:** [May 8, 2022, 2:14pm UTC](https://forum.inductiveautomation.com/t/reporting-module-date-data-type/59333 "2022-05-08T14:14:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neil\_Carty](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@Neil\_Carty](https://forum.inductiveautomation.com/u/Neil_Carty)\
**Post date:** [May 8, 2022, 2:14pm UTC](https://forum.inductiveautomation.com/t/reporting-module-date-data-type/59333/1 "2022-05-08T14:14:09Z")

</div>

I am trying to run a basic SQl query in the reporting module but the data type Date for the start and stop times is producing a string for the date. Is there a way to get a DateTime date type on these parameters?

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [May 8, 2022, 9:34pm UTC](https://forum.inductiveautomation.com/t/reporting-module-date-data-type/59333/2 "2022-05-08T21:34:10Z")

</div>

Maybe show us how you are assigning values to your parameters and the query?

If you are using something like the date time input then the `value` property should be a datetime, but if you are using the `formatted value` property that will be interpreted as a string.

You also have options in the query to convert to a date time, something like this as an example:  
`CONVERT(DATETIME, ?, 120)`

---

<div class="post-metadata">

**Author:** ![Neil\_Carty](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@Neil\_Carty](https://forum.inductiveautomation.com/u/Neil_Carty)\
**Post date:** [May 8, 2022, 10:52pm UTC](https://forum.inductiveautomation.com/t/reporting-module-date-data-type/59333/3 "2022-05-08T22:52:46Z")

</div>

This is my query.  
SELECT BPR\_B40DieNum,  
BPR\_B40BilletTotal,  
avg(BPR\_B40ExtrudeTime) AS ‘Average\_ExtTime’,  
avg(BPR\_R2R\_Active) AS ‘Average\_R2R’,  
avg(BPR\_R2R\_Active) / avg(BPR\_B40ExtrudeTime) AS ‘R2R\_Percent’  
FROM Epics.foy.SCM\_DW\_Boss\_Billet2  
WHERE EventTime \>= convert(DateTime,{[default]Reports/Reports\_12HrStartTime.value},120) AND EventTime \<= convert(DateTime,{[default]Reports/ReportsStopTime.value},120) AND BPR\_B40BilletCount \> 3 AND  
BPR\_B40ExtrudeTime \<= 299 AND Bpr\_B40BilletCount \< Bpr\_B40BilletTotal  
GROUP BY BPR\_B40DieNum,  
Bpr\_B40BilletTotal

this has the convert option that you suggested in it as well. The tag values are from two expression tags with data type DateTime, StopTime expression of now() and the start date uses a dateArithmetic of -24 “hr” from the stop time.

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [May 8, 2022, 11:14pm UTC](https://forum.inductiveautomation.com/t/reporting-module-date-data-type/59333/4 "2022-05-08T23:14:06Z")

</div>

Next time use the preformatted text button `</>` for better readability. Ok, so you aren’t using parameters at all (those are denoted by “?” in your query). I don’t see a reason that wouldn’t work, though you don’t need two tags. You can just use the stop tag and do date arithmetic in the query.  
Something like this:

```auto
DATEADD(hour, -24, StopTime)

```

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [May 9, 2022, 2:04pm UTC](https://forum.inductiveautomation.com/t/reporting-module-date-data-type/59333/5 "2022-05-09T14:04:12Z")

</div>

You should probably parameterize theses. An example Note the question marks in the query, with the parateres at the bottom of the :  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/3/03aafddab88c24bc58bc974e068b0413df5c4666.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/d/1da9a05bf95faa0472fc6dc57bb9f5e3a4b6884a.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/0/80c59e326dc49fd93f7b75d753aad4c760b94159.png)

---

<div class="post-metadata">

**Author:** ![Neil\_Carty](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@Neil\_Carty](https://forum.inductiveautomation.com/u/Neil_Carty)\
**Post date:** [May 9, 2022, 2:51pm UTC](https://forum.inductiveautomation.com/t/reporting-module-date-data-type/59333/6 "2022-05-09T14:51:50Z")

</div>

That did it!! Thank you very much Jordan.
