# Unexpected timestamp after downsampling

**URL:** <https://community.influxdata.com/t/unexpected-timestamp-after-downsampling/30317>\
**Category:** InfluxDB 2\
**Tags:** downsample\
**Created:** [June 15, 2023, 3:25pm UTC](https://community.influxdata.com/t/unexpected-timestamp-after-downsampling/30317 "2023-06-15T15:25:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lutte](https://avatars.discourse-cdn.com/v4/letter/l/8baadc/32.png) [@Lutte](https://community.influxdata.com/u/Lutte)\
**Post date:** [June 15, 2023, 3:25pm UTC](https://community.influxdata.com/t/unexpected-timestamp-after-downsampling/30317/1 "2023-06-15T15:25:29Z")

</div>

If have create a task

> option task = {name: “TestTask”, every: 5m, offset: 1m}
> 
> from(bucket: “HausTest”)  
> |\> range(start: -task.every)  
> |\> filter(fn: (r) =\> r[“\_measurement”] == “fronius”)  
> |\> drop(columns: [“requestTimeStamp”, “source”])  
> |\> aggregateWindow(every: 5m, fn: mean, createEmpty: false)  
> |\> to(bucket: “HausStundenArchiv”)  
> In the bucket “HausStundenArchiv” I expect times like  
> 2023-06-15T14:45:00.000Z but what I get looks like  
> 2023-06-15T14:45:10.000Z

Is this expected? And how can get my expected timestamp?

---

<div class="post-metadata">

**Author:** ![Anaisdg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/anaisdg/32/6401_2.png) [@Anaisdg](https://community.influxdata.com/u/Anaisdg)\
**Post date:** [June 15, 2023, 8:46pm UTC](https://community.influxdata.com/t/unexpected-timestamp-after-downsampling/30317/2 "2023-06-15T20:46:52Z")

</div>

Hello @Lutte,  
Welcome!

> The interval at which the task runs. This option also determines when the task first starts to run, depending on the specified time (in [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals)).  
> _ **Data type:** Duration_  
> For example, if you save or schedule a task at 2:30 and run the task every hour (`1h`):  
> `option task = {name: "aggregation", every: 1h}`  
> The task first executes at 3:00pm, and subsequently every hour after that.

So most likely you’re starting the task at 45:6 or something and so it starts at the next 5 min interval.

I dont know maybe you can achieve this with cron instead?

> **[InfluxDB task configuration options | InfluxDB Cloud (TSM) Documentation](https://docs.influxdata.com/influxdb/cloud/process-data/task-options/#cron)**
>
> Task options define specific information about a task such as its name, the schedule on which it runs, execution delays, and others.

I haven’t used it a lot, so im not sure. Maybe `*/5 * * * *`

---

<div class="post-metadata">

**Author:** ![Lutte](https://avatars.discourse-cdn.com/v4/letter/l/8baadc/32.png) [@Lutte](https://community.influxdata.com/u/Lutte)\
**Post date:** [June 16, 2023, 7:48am UTC](https://community.influxdata.com/t/unexpected-timestamp-after-downsampling/30317/3 "2023-06-16T07:48:29Z")

</div>

Thank you for the fast answer.  
It was my mistake. The downsampled timestampes are as expected.  
I was looking at the downsampled data with an aggregation in the query, which caused the unexpected timestamps.
