# Convert int to DateTime in Nest query?

**URL:** <https://discuss.elastic.co/t/convert-int-to-datetime-in-nest-query/284937>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [September 22, 2021, 7:45pm UTC](https://discuss.elastic.co/t/convert-int-to-datetime-in-nest-query/284937 "2021-09-22T19:45:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bensalerno](https://avatars.discourse-cdn.com/v4/letter/b/9dc877/32.png) [@bensalerno](https://discuss.elastic.co/u/bensalerno)\
**Post date:** [September 22, 2021, 7:45pm UTC](https://discuss.elastic.co/t/convert-int-to-datetime-in-nest-query/284937/1 "2021-09-22T19:45:53Z")

</div>

I am attempting to query an ES cluster through Nest. However, I'm having an issue because my types are not matching.

This is the C# side:

 ![Screen Shot 2021-09-22 at 9.47.29 AM](https://us1.discourse-cdn.com/elastic/original/3X/3/0/3005dc0bbe349147021d902f31d925885b105bdd.png)

As you can see CreatedTimeStamp is a DateTime.

However, this is what I receive in Postman:

 ![Screen Shot 2021-09-22 at 12.17.30 PM](https://us1.discourse-cdn.com/elastic/original/3X/b/4/b4d61855ff8ded240e85b32f09a47882fa2e4b87.png)

Where CreatedTimeStamp is now an Int (or Long).

When I run this basic query:

```auto
var searchResponse = Event.client.Search<mdl.Event>(s => s
                    .From(0)
                    .Size(1000)
                    .Query(q => q
                        .MatchAll()));

```

This is causing the following error:

Elasticsearch.Net.Utf8Json.JsonParsingException : expected:'String Begin Token', actual:'1631555771000', at offset:344

Basically, how can I convert the type from ES to fit the C#?

---

<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:** [October 20, 2021, 7:46pm UTC](https://discuss.elastic.co/t/convert-int-to-datetime-in-nest-query/284937/2 "2021-10-20T19:46:01Z")

</div>

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