How can I filter data in order to get only the data for current month?

Hi all!

My name is Pedro and I have a question regarding data filtering in Analysis.
I need to filter certain variable from my bucket, and the data filtered must be refered to the current month (I mean, if we’re in November/2020, I need to get variable values only from November/01/2020 to November/30/2020).

Searching in TagoIO documentation, I’ve found that when I set start_date as 1 month, it gets the last 30 data. Therefore, it’ll get data from last month too, what makes it different from what I need.

Please, would anyone help me in how I can filter the data of current month only?

Best Regards,
Pedro Bertoleti

Hi @phfbertoleti,

You can use the query start_date and end_date to filter the data as this documentation.

I’m using the lib moment to manage the datetime, see the docs here.

To resolve it see the following this example:
const moment = require(‘moment’);

const month = moment().format(‘MM’);
const year = moment().format(‘YYYY’);

const filter = {
start_date: ${year}-${month}-01T00:00:00.000Z
};

@eger, thank you very much!