# Flux: Get value by \_time

**URL:** <https://community.influxdata.com/t/flux-get-value-by-time/30773>\
**Category:** InfluxDB 2\
**Tags:** influxdb, query, flux\
**Created:** [July 18, 2023, 6:55pm UTC](https://community.influxdata.com/t/flux-get-value-by-time/30773 "2023-07-18T18:55:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ka\_gia](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/ka_gia/32/13919_2.png) [@ka\_gia](https://community.influxdata.com/u/ka_gia)\
**Post date:** [July 18, 2023, 6:55pm UTC](https://community.influxdata.com/t/flux-get-value-by-time/30773/1 "2023-07-18T18:55:33Z")

</div>

Hi all,

I want to get data with specific date (saved as timestamp). I’ve tried filtering by `_time`, but I don’t see any results.  
Used query is:

> from(bucket: “sample\_bucket”)  
> |\> range(start: v.timeRangeStart, stop: v.timeRangeStop)  
> |\> filter(fn: (r) =\> r[“\_measurement”] == “versions” and r.project == “sample\_project” and r.\_field == “commit” and r.\_time == time(v: 1689681583))

Is it possible to get value “commit” having specified timestamp? What is wrong in this query?

Thanks a lot 🙂

---

<div class="post-metadata">

**Author:** ![fercasjr](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@fercasjr](https://community.influxdata.com/u/fercasjr)\
**Post date:** [July 18, 2023, 7:45pm UTC](https://community.influxdata.com/t/flux-get-value-by-time/30773/2 "2023-07-18T19:45:09Z")

</div>

are you sure that the timestamp is correct?

I have done that, and you can definitely filter by time.

Make sure that your \_time value is between the range you selected first, you could use:

```auto

|> range(start:0)

```

to make sure you have all \_time values but I only recommend that If you are going to use filter by \_time or if you don’t have too many data points.

---

<div class="post-metadata">

**Author:** ![ka\_gia](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/ka_gia/32/13919_2.png) [@ka\_gia](https://community.influxdata.com/u/ka_gia)\
**Post date:** [July 19, 2023, 7:26am UTC](https://community.influxdata.com/t/flux-get-value-by-time/30773/3 "2023-07-19T07:26:57Z")

</div>

Thank you @fercasjr 🙂

I checked correctness of the timestamp and it is correct.  
Is timezone (or another thing) important to query by `_time`?

---

<div class="post-metadata">

**Author:** ![fercasjr](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@fercasjr](https://community.influxdata.com/u/fercasjr)\
**Post date:** [July 19, 2023, 12:46pm UTC](https://community.influxdata.com/t/flux-get-value-by-time/30773/4 "2023-07-19T12:46:08Z")

</div>

yes, everything in InfluxDB is stored as UTC timestamp. you could set time zone

> [@ka\_gia](#):
>
> I checked correctness of the timestamp and it is correct.  
> Is timezone (or another thing) important to query by `_time`?

or time offset to accommodate to local time.

[timezone.fixed() function | Flux 0.x Documentation (influxdata.com)](https://docs.influxdata.com/flux/v0.x/stdlib/timezone/fixed/#Copyright)

---

<div class="post-metadata">

**Author:** ![fercasjr](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@fercasjr](https://community.influxdata.com/u/fercasjr)\
**Post date:** [July 19, 2023, 12:49pm UTC](https://community.influxdata.com/t/flux-get-value-by-time/30773/5 "2023-07-19T12:49:25Z")

</div>

> [@ka\_gia](#):
>
> time(v: 1689681583))

I know what the problem is!!!  
time(v: 1689681583) = 1970-01-01 00:00:01 UTC

remember that Influx time is in ns:

 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/f/fcf3ae18e5eea18c8dc75771e6c590538eb9548b.png)

---

<div class="post-metadata">

**Author:** ![ka\_gia](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/ka_gia/32/13919_2.png) [@ka\_gia](https://community.influxdata.com/u/ka_gia)\
**Post date:** [July 20, 2023, 7:46am UTC](https://community.influxdata.com/t/flux-get-value-by-time/30773/6 "2023-07-20T07:46:07Z")

</div>

I found this information too and it was a reason of issue.

@fercasjr thanks 🙂
