# Node date picker y mysql

**URL:** https://discourse.nodered.org/t/node-date-picker-y-mysql/64372
**Category:** General
**Created:** [25 June 2022 21:49 UTC](https://discourse.nodered.org/t/node-date-picker-y-mysql/64372 "2022-06-25T21:49:04Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [26 June 2022 00:55 UTC](https://discourse.nodered.org/t/node-date-picker-y-mysql/64372/2 "2022-06-26T00:55:31Z")

</div>

[This thread](https://discourse.nodered.org/t/converting-datetime-to-dd-mm-yyyy-hh-mm/36012) describes converting the date picker output format.

I adapted it to convert the date to YYYY-MM-HH and constructed this select statement which works for me:

```auto
select * from socketevent where ontime between "2022-06-02" and "22-06-05";
+------+---------------------+--------+---------------------+--------+------+
| id | ontime | onkwh | offtime | offkwh | temp |
+------+---------------------+--------+---------------------+--------+------+
| 5445 | 2022-06-02 06:56:52 | 31.12 | 2022-06-02 07:26:52 | 31.302 | NULL |
| 5446 | 2022-06-02 08:36:55 | 31.302 | 2022-06-02 08:43:08 | 31.396 | NULL |
| 5447 | 2022-06-02 13:55:50 | 31.397 | 2022-06-02 14:08:09 | 31.528 | NULL |
| 5448 | 2022-06-03 07:38:25 | 31.528 | 2022-06-03 08:08:26 | 31.688 | NULL |
| 5449 | 2022-06-03 08:08:34 | 31.69 | 2022-06-03 08:20:18 | 31.737 | NULL |
| 5450 | 2022-06-04 07:48:50 | 31.737 | 2022-06-04 08:18:50 | 31.934 | NULL |
| 5451 | 2022-06-04 08:35:52 | 31.935 | 2022-06-04 09:05:52 | 32.048 | NULL |

```

Note that "2022-06-02" is interpreted by the database as "2022-06-02 00:00" so records from 2nd June are retrieved, but no records from 5th June are.

---

_[View the full topic](https://discourse.nodered.org/t/node-date-picker-y-mysql/64372)._
