none
Power Query - get todays date? RRS feed

  • Question

  • Hi - Is there a function to get todays date in Power Query?

    thanks.


    Thank you for you time folks!

    Tuesday, May 20, 2014 12:50 PM

Answers

All replies

  • DateTime.LocalNow Returns a datetime value set to the current date and time on the system

    Here is a list of Power Query Formulas

    Regards

    Tuesday, May 20, 2014 1:50 PM
  • Try this which uses two functions, one to get the current date/time and another to convert it to a date only:

    DateTime.Date(DateTime.LocalNow())

    • Proposed as answer by Tim Rodman Monday, June 22, 2015 1:24 PM
    Monday, June 22, 2015 1:24 PM
  • Very very thank you!!
    Friday, March 3, 2017 3:50 PM
  • Is it possible to construct a URL with date in?

    I have this API call that has a date in, and I wondered if it was possible to make the date elements dynamic

    Source = Json.Document(Web.Contents("/api/?action=get_events&from=2018-10-30&to=2018-11-01&league_id=62&APIkey=))

    I think the kind of thing I'm trying to achieve is something like

    Source = Json.Document(Web.Contents("/api/?action=get_events&from="DateTime.Date(DateTime.LocalNow())"to="DateTime.Date(DateTime.LocalNow())+5"&league_id=62&APIkey=))

    Any suggestions would be appreciated!


     


    • Edited by dahipster Thursday, December 6, 2018 12:10 AM more detail added
    Thursday, December 6, 2018 12:08 AM
  • There is a Date.ToText function that can be used to format dates into text for use in something like that.

     Date.ToText(DateTime.Date(DateTime.LocalNow()),"yyyy-MM-dd")

    Would convert the current date into the format you showed there. You can use functions like Date.AddDays to look forward/back x days from now as well.

    Thursday, December 6, 2018 12:27 AM
  • Hi

    I am facing the same issue. Did anyone figure this out? How can we assign todays date to "&to=". Any help would be appreciated.

    I have tried the following and have only experience errors:

    &dTo=Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy-MM-dd")

    Wednesday, October 16, 2019 9:07 PM
  • Thank you so much. 
    Saturday, October 19, 2019 4:44 AM