# Vega Transform Timestamp to date

**URL:** <https://discuss.elastic.co/t/vega-transform-timestamp-to-date/238834>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [June 26, 2020, 10:25am UTC](https://discuss.elastic.co/t/vega-transform-timestamp-to-date/238834 "2020-06-26T10:25:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![issaissa](https://avatars.discourse-cdn.com/v4/letter/i/3be4f8/32.png) [@issaissa](https://discuss.elastic.co/u/issaissa)\
**Post date:** [June 26, 2020, 10:25am UTC](https://discuss.elastic.co/t/vega-transform-timestamp-to-date/238834/1 "2020-06-26T10:25:38Z")

</div>

In vega-lite I can transform timestamp into time type after reading it from index as follows:

` transform: [{calculate: "toDate(datum._source['measure_date_time'])", as: "time"} ]`

what is the equivalent for this in vega? I couldn't find any documentation on transform to timestamp as time in vega docs.

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [June 26, 2020, 2:59pm UTC](https://discuss.elastic.co/t/vega-transform-timestamp-to-date/238834/2 "2020-06-26T14:59:45Z")

</div>

When converting between the two types, I usually use the online Vega editor and export my vega-lite spec into Vega.

In this case, you probably need to replace this with the Vega "formula": [https://vega.github.io/vega/docs/transforms/formula/](https://vega.github.io/vega/docs/transforms/formula/)

Transforms in Vega go into the `data` section, which is different from Vega-lite: [https://vega.github.io/vega/docs/transforms/](https://vega.github.io/vega/docs/transforms/)

---

<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:** [July 24, 2020, 2:59pm UTC](https://discuss.elastic.co/t/vega-transform-timestamp-to-date/238834/3 "2020-07-24T14:59:47Z")

</div>

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