Forum Discussion
Anonymous
3 years agoNot applicable
Defining today's date on advanced editor
Hey guys, I'm pulling data out of a POST API, and one of the requested headers is the date period that will be retrieved. Here's what I've got so far: let
url = "https://my.url.co...
amitchandak
3 years agoSuper User
Anonymous , Please try this
current date
Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy-MM-dd")
Month Start
Date.ToText(Date.StartOfMonth(DateTime.Date(DateTime.LocalNow())), "yyyy-MM-dd")
- Anonymous3 years agoNot applicable
Thanks for your reply, amitchandak.
Any thoughts on why this happened?
let url = "https://my.url.com/Report/SomeReport", hoje = Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy-MM-dd"), body = "{""DtInicio"": ""2022-10-01"",""DtFim"": "& hoje &"}", Source = Json.Document(Web.Contents( url, [Headers = [#"Content-Type"="application/json", #"Authorization"="XXXX-8784-XXXXX-8799-XXXXXXXXXXX"], Content = Text.ToBinary(body)] ) ), result = Source[result] in #"Renamed Columns"- amitchandak3 years agoSuper User
Anonymous , it is checking for numbers
may be like
Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyyMMdd")
- Anonymous3 years agoNot applicable
Thanks for your response.
The following message shows up:
When I used the code with slashs, I got the following error
Code: ... Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy/MM/dd") ... Error message: “Error parsing comment. Expected: *, got 1. Path 'DtFim', line 1, position 40.”Is it possible to create a function and use this created function into my code? I'm a total newbie on Power Query's M language, so it's just a guess.