Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Formatting Date in query editor

Hi All,

 

I am using query editor to call web.content through an API.

 

In the api i Pass the date something like StartDate >= 2022-02-01 AND EndDate<= 2022-02-28. I need this to be moving window of 30 days hence i want this to be calculated.

 

I already get the number of pages API is returning and store in table before i pass recursively to the final API. There i want to add columns of start date and end date.

 

The problem I am facing is when add column with Date.From(DateTime.LocalNow() i get the date as 3/1/2022 which is mm/dd/yyyy and seprated by slashes.

But for passing it to the query the date format should be yyyy-mm-dd seprated by the dashes i.e. 3/1/2022 -> 2022-03-01

 

Please help with the issue

Thanks

Anuj

 

4 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      OK it worked with some parameters thanks fo the insights.

       

      Just for the help of community here is what i did Date.ToText(Date.From(DateTime.LocalNow()),"s")

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi amitchandak Date.From(DateTime.LocalNow()) retruns text so the Date.ToText conversion does not work Am I missing something here

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    My apologies it works but Date.ToText(Date.From(DateTime.LocalNow()), [Format = "yyyy-mm-dd"]), the format i need is not getting created