# Error parsing datetime using Script Processor

**URL:** <https://discuss.elastic.co/t/error-parsing-datetime-using-script-processor/320332>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [December 2, 2022, 8:02am UTC](https://discuss.elastic.co/t/error-parsing-datetime-using-script-processor/320332 "2022-12-02T08:02:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![m14](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@m14](https://discuss.elastic.co/u/m14)\
**Post date:** [December 2, 2022, 8:02am UTC](https://discuss.elastic.co/t/error-parsing-datetime-using-script-processor/320332/1 "2022-12-02T08:02:34Z")

</div>

Hi,

I need to get the date and time from the log record.  
In JavaScript I can just do the following:

```auto
var d = new Date("Oct 27, 2022 1:39:57 PM");

```

But the script processor seems nto to be able to do this.  
When I try (for testing purposes) to just write to another field - it says "invalid date".

Any advice how to deal with this?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 30, 2022, 10:03am UTC](https://discuss.elastic.co/t/error-parsing-datetime-using-script-processor/320332/2 "2022-12-30T10:03:11Z")

</div>

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