Forum Discussion

apipko's avatar
apipko
New Member
9 years ago
Solved

Insert current date in extended editor

I get data via json

 

let
content = "
{
  ""dimensions"": [""daily""],
  ""metrics"": [""visits"",""leads"",""sales"",""profit"",""marketing_cost"",""roi""],
  ""period"": {
    ""from"":""2017-06-06T00:00:00+0300"",
    ""to"":""2017-07-05T23:59:59+0300""
  }
}
",  

How to insert in "to" current date automatically in extended editor? Thank you!

 

  • apipko,

     

    See text below.

        ""to"":""" & DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-dd") & "T00:00:00+0300""

4 Replies

  • let
    content = "
    {
      ""dimensions"": [""daily""],
      ""metrics"": [""paidLeadsPrice"",""visits"",""leads"",""sales"",""profit"",""visitsCost"",""roi""],
      ""period"": {
        ""from"":""2017-06-01T00:00:00+0300"",
        ""to"":""2017-07-01T00:00:00+0300""
      }
    }
    ",
        Source = Json.Document(Web.Contents("https://cloud.roistat.com/api/v1/project/analytics/data?project=50147&key=52d70cb079888f14092d5e9e13e3c3cb", [Content=Text.ToBinary(content)]))
    in
        Source

    This is a working example, please show how to insert the current date in the field ""to"" automically?

    • v-chuncz-msft's avatar
      v-chuncz-msft
      Icon for Community Support rankCommunity Support

      apipko,

       

      See text below.

          ""to"":""" & DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-dd") & "T00:00:00+0300""