# How to convert timestamp in milliseconds i,e long using elastic-sql

**URL:** <https://discuss.elastic.co/t/how-to-convert-timestamp-in-milliseconds-i-e-long-using-elastic-sql/295347>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-sql\
**Created:** [January 25, 2022, 12:58pm UTC](https://discuss.elastic.co/t/how-to-convert-timestamp-in-milliseconds-i-e-long-using-elastic-sql/295347 "2022-01-25T12:58:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Samm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_samm/32/48390_2.png) [@David\_Samm](https://discuss.elastic.co/u/David_Samm)\
**Post date:** [January 25, 2022, 12:58pm UTC](https://discuss.elastic.co/t/how-to-convert-timestamp-in-milliseconds-i-e-long-using-elastic-sql/295347/1 "2022-01-25T12:58:51Z")

</div>

```auto
Hi,

I have timestamp fields where I want to convert this timestamp to long i,e milliseconds

GET /_sql
{

  "query":"select "2017-11-13T13:51:00.000Z" as date from employee "

}
    here I want the timestamp "2017-11-13T13:51:00.000Z" to some 510561260000 value

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 27, 2022, 2:48am UTC](https://discuss.elastic.co/t/how-to-convert-timestamp-in-milliseconds-i-e-long-using-elastic-sql/295347/2 "2022-01-27T02:48:05Z")

</div>

Can you please reformat your post so it's readable. You don't need to have the entire thing as a quote block 🙂

---

<div class="post-metadata">

**Author:** ![David\_Samm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_samm/32/48390_2.png) [@David\_Samm](https://discuss.elastic.co/u/David_Samm)\
**Post date:** [January 27, 2022, 5:50am UTC](https://discuss.elastic.co/t/how-to-convert-timestamp-in-milliseconds-i-e-long-using-elastic-sql/295347/3 "2022-01-27T05:50:30Z")

</div>

hi @warkolm ,

I am unable to edit my previous post so I have created a new one  
[[How to convert timestamp in milliseconds i,e long using elastic-sql](https://discuss.elastic.co/t/how-to-convert-timestamp-in-milliseconds-i-e-long-using-elastic-sql/295543)]([https://New](https://New) One)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 27, 2022, 6:41am UTC](https://discuss.elastic.co/t/how-to-convert-timestamp-in-milliseconds-i-e-long-using-elastic-sql/295347/4 "2022-01-27T06:41:12Z")

</div>


