Forum Discussion
apipko
9 years agoNew Member
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!
See text below.
""to"":""" & DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-dd") & "T00:00:00+0300""
4 Replies
- Greg_Deckler
Community Champion
If I paste that code into Advanced Editor it errors. That also does not appear to be valid JSON syntax so I am a little confused. Date.LocalNow will return the current date and time.
https://msdn.microsoft.com/en-us/library/mt253492.aspx
- v-chuncz-msft
Community Support
- apipkoNew Member
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 SourceThis is a working example, please show how to insert the current date in the field ""to"" automically?
- v-chuncz-msft
Community Support
See text below.
""to"":""" & DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-dd") & "T00:00:00+0300""