# Difference between the two different timestamp

**URL:** <https://community.influxdata.com/t/difference-between-the-two-different-timestamp/16318>\
**Category:** Systems\
**Created:** [October 13, 2020, 3:26am UTC](https://community.influxdata.com/t/difference-between-the-two-different-timestamp/16318 "2020-10-13T03:26:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amanmishra1321](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@amanmishra1321](https://community.influxdata.com/u/amanmishra1321)\
**Post date:** [October 13, 2020, 3:26am UTC](https://community.influxdata.com/t/difference-between-the-two-different-timestamp/16318/1 "2020-10-13T03:26:39Z")

</div>

how can I get the time difference between the two different time stamps column. i.e.  
two different measurements have different timestamp column. And I want the difference between that two time stamps.I had studied about elapsed function but it is giving us the difference between the earlier record and the next one.

---

<div class="post-metadata">

**Author:** ![philjb](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/philjb/32/5405_2.png) [@philjb](https://community.influxdata.com/u/philjb)\
**Post date:** [October 13, 2020, 5:48am UTC](https://community.influxdata.com/t/difference-between-the-two-different-timestamp/16318/2 "2020-10-13T05:48:39Z")

</div>

I’m not sure which version you are using but this is supported in 1.8 and 2.0.

For influxql, you can do a subtraction in the SELECT clause like `SELECT "ts1" - "ts2" WHERE ...`.

See these docs: [InfluxQL mathematical operators | InfluxDB OSS 1.8 Documentation](https://docs.influxdata.com/influxdb/v1.8/query_language/math_operators/#subtraction)

Flux language has this capability to with the `map` method.

Let us know what worked for you!

---

<div class="post-metadata">

**Author:** ![amanmishra1321](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@amanmishra1321](https://community.influxdata.com/u/amanmishra1321)\
**Post date:** [October 13, 2020, 12:35pm UTC](https://community.influxdata.com/t/difference-between-the-two-different-timestamp/16318/3 "2020-10-13T12:35:27Z")

</div>

thanks for the instant reply  
I have a question… How can we add 2 time stamp in influxdb… actually I wanna add some extra information regarding time but on searching about it I got “you can a time column by writing unix time at the end of influxql” but the problem is I want two time column with different name and data inside it. Is it possible to add two or more time column?

---

<div class="post-metadata">

**Author:** ![philjb](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/philjb/32/5405_2.png) [@philjb](https://community.influxdata.com/u/philjb)\
**Post date:** [October 16, 2020, 8:30pm UTC](https://community.influxdata.com/t/difference-between-the-two-different-timestamp/16318/4 "2020-10-16T20:30:03Z")

</div>

You can use additional fields to store time data but there is only one `timestamp`. The timestamp is treated different by the database - there is only one of these. Is sounds like you want two _series_.

For example:

```auto
dataFieldA=1234 timestampA
dataFieldB=9876 timestampB

```

This is normal.

We don’t usually recommend this:

`dataFieldA=1234 dataFieldATimestamp=12:00:00 timestampA`

---

<div class="post-metadata">

**Author:** ![amanmishra1321](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@amanmishra1321](https://community.influxdata.com/u/amanmishra1321)\
**Post date:** [October 17, 2020, 1:52am UTC](https://community.influxdata.com/t/difference-between-the-two-different-timestamp/16318/5 "2020-10-17T01:52:13Z")

</div>

Thanks for clearing my doubt
