Hello @Karan12592,
I’m not sure that this is possible with InfluxQL However you can do this with Flux. What version of InfluxDB are you using?
There are tons of ways to manipulate time with Flux, but you’ll want. to use the timeShift() function
Functions to manipulate timestamps: Time series data is difficult to work with. Flux includes several functions to work with time. However, a couple of these functions are spread out between various community package contributions and Flux packages within the documentation. A consolidated list of all of these functions provide you with a deeper understanding of how you can use Flux to work with time. The following functions allow you to manipulate your timestamps and execute a variety of time series transformations. Including:
- hourSelection(): select data between specific parts of the day.
- duration(): convert a timestamp to a duration in terms of seconds, minutes, hours, etc.
- events.Duration(): calculate the duration between events
- now(): return the current time
- system.time(): return the current time of the system
- time(): convert a Unix nanosecond timestamp to an RFC3339 timestamp
- uint(): convert RFC3339 timestamp to a Unix nanosecond timestamp
- truncateTimeColumn(): round or truncate an entire column to a specific timestamp unit
- date.truncate(): round or truncate data down to a specific timestamp unit.
- experimental.addDuration()*: add timestamps to each other
- experimental.subDuration()*: subtract timestamps from each other
- experimental.alignTime()*: compare data across a window; i.e., week over week or month over month.