# From string to date

**URL:** <https://discourse.nodered.org/t/from-string-to-date/34371>\
**Category:** General\
**Created:** [16 October 2020 20:46 UTC](https://discourse.nodered.org/t/from-string-to-date/34371 "2020-10-16T20:46:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![christian19](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian19/32/23687_2.png) [@christian19](https://discourse.nodered.org/u/christian19)\
**Post date:** [16 October 2020 20:46 UTC](https://discourse.nodered.org/t/from-string-to-date/34371/1 "2020-10-16T20:46:18Z")

</div>

Hi!  
Use a web-scrape to get a date from a web page. Any suggestions on how I get this message to a date?

```auto
                                            19. okt                                        

```

![Skjermbilde 2020-10-16 kl. 22.45.51](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/7/a740ef862a592510147bc8e3133c2c9d05d2636e.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 October 2020 08:47 UTC](https://discourse.nodered.org/t/from-string-to-date/34371/2 "2020-10-17T08:47:30Z")

</div>

What do you mean by "get this message to a date"?

---

<div class="post-metadata">

**Author:** ![christian19](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian19/32/23687_2.png) [@christian19](https://discourse.nodered.org/u/christian19)\
**Post date:** [17 October 2020 10:31 UTC](https://discourse.nodered.org/t/from-string-to-date/34371/3 "2020-10-17T10:31:19Z")

</div>

Im hoping to get the string date into a variable I use in Home-Assistant..

> **[Input Datetime](https://www.home-assistant.io/integrations/input_datetime/)**
>
> Instructions on how to integrate the Input Datetime integration into Home Assistant.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 October 2020 16:18 UTC](https://discourse.nodered.org/t/from-string-to-date/34371/4 "2020-10-17T16:18:42Z")

</div>

Is that example meant to be the 28th of October?

If so, as long as the format is consistent, you should be able to use either the moment node or JSONata's momentjs implementation to convert it to a date.

By the way though, this is the Node-RED forum, not the Home Assistant forum. Problems with HA should be directed to their forum.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 December 2020 16:18 UTC](https://discourse.nodered.org/t/from-string-to-date/34371/5 "2020-12-16T16:18:43Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
