# \[SOLVED\] Format SQL Query results inside a power table

**URL:** <https://forum.inductiveautomation.com/t/solved-format-sql-query-results-inside-a-power-table/32345>\
**Category:** Ignition\
**Created:** [February 17, 2020, 6:57pm UTC](https://forum.inductiveautomation.com/t/solved-format-sql-query-results-inside-a-power-table/32345 "2020-02-17T18:57:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 17, 2020, 6:57pm UTC](https://forum.inductiveautomation.com/t/solved-format-sql-query-results-inside-a-power-table/32345/1 "2020-02-17T18:57:46Z")

</div>

I have a power table with the following query:

```
SELECT MachineName, MachineStatus, MachineTag, DateAdded
FROM Table
ORDER BY DateAdded DESC;

```

Date Added shows up in a typical format YYYY-MM-DD HH:MM:SS but is there a way to format the results of DateAdded to [HH:MM:SS - (01:30:00)] so the results appear as a clock?

Hence a timer starting at -90 minutes and eventually counting up.

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [February 17, 2020, 7:15pm UTC](https://forum.inductiveautomation.com/t/solved-format-sql-query-results-inside-a-power-table/32345/2 "2020-02-17T19:15:42Z")

</div>

If your just talking about changing the date format so it only shows HH:mm:ss, then yes. If you go into the [table customizer](https://docs.inductiveautomation.com/display/DOC80/Vision+-+Power+Table+Customizer) by right clicking on your power table, you can set your date format to whatever you want it to be in there.

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 17, 2020, 7:20pm UTC](https://forum.inductiveautomation.com/t/solved-format-sql-query-results-inside-a-power-table/32345/3 "2020-02-17T19:20:38Z")

</div>

Well I’d like to apply a function on the DateAdded column after it’s been queried from the database.

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [February 17, 2020, 7:22pm UTC](https://forum.inductiveautomation.com/t/solved-format-sql-query-results-inside-a-power-table/32345/4 "2020-02-17T19:22:15Z")

</div>

What kind of function?

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [February 17, 2020, 7:24pm UTC](https://forum.inductiveautomation.com/t/solved-format-sql-query-results-inside-a-power-table/32345/5 "2020-02-17T19:24:22Z")

</div>

You could also [format](https://docs.microsoft.com/en-us/sql/t-sql/functions/format-transact-sql?view=sql-server-ver15) the datetime in your SQL query.

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 17, 2020, 7:40pm UTC](https://forum.inductiveautomation.com/t/solved-format-sql-query-results-inside-a-power-table/32345/6 "2020-02-17T19:40:11Z")

</div>

Thanks, that was the key to success.

```
SELECT MachineName, MachineStatus, MachineTag, DATEDIFF(minute, CURRENT_TIMESTAMP, DATEADD(minute, 90, DateAdded)) AS DateAdded FROM Table;
```
