Count no. of newly registered member in this month

Hi everyone.
I would like to display the no. of new member using WixDataQuery.
This is my idea but it is not working:

const today = new Date();
let mth = today.getMonth().toString();

if (mth === “0”) {
mth = “jan”; //not sure about the format
}
else if (mth === “1”) {
mth = “feb”;
}
//same code for 12mths

wixData.query(“Cand_reg”)
.contains(“_createdDate”, mth) //not working and cannot only search for same year
.count()
.then((num) => {
let numberOfItems = num;
$w(“#amount”).text = numberOfItems.toString();
})
. catch ((error) => {
let errorMsg = error.message;
let code = error.code;
});

Thank you!!!

In order to achieve your goal you will need some helper functions to help you to run iterations through the days of the month and the months of the year. I would recommend check out step 14 in this article to learn how to work with date and time.

Thank you Sam. I am really new to coding so I have no idea what to do actually…but thanks again for your kind advice!