Ivan is writing an api query, and from the api’s documentation he finds out that the response can be filtered to only show data created since a defined date (using the “created_since” parameter). Ivan wants to filter the data that was created since the beginning of the month, and the input format of the “create_since” parameter should be “yy MMM dd”. What is the date/time function Ivan should pass to the “created_since” paramter in his query?

✅  The correct answer is:

date.startOfMonth.format(“yy MMM dd”)

Question:

Ivan is writing an api query, and from the api’s documentation he finds out that the response can be filtered to only show data created since a defined date (using the “created_since” parameter). Ivan wants to filter the data that was created since the beginning of the month, and the input format of the “create_since” parameter should be “yy MMM dd”. What is the date/time function Ivan should pass to the “created_since” paramter in his query?

Solution:

  • date.startOfYear.format(“yyyyMMdd”)
  • date.addMonths(-1).format()
  • date.startOfMonth.format(“yy MMM dd”)
  • date.add(-5).format(“yy MMM dd”)
  • date.addMonths(-1).endOfMonth.format()