Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Problem Updating URL with Unix Times

Hello all,   I am currently making a dashboard that pulls stock prices from Yahoo Finance with an end date of the current day and a start date of 30 days prior. I have figured out how to create a f...
  • mahoneypat's avatar
    3 years ago

    Please try this syntax. You need to convert your start and end to text to concat them with the rest of the url.

     

    let
        StartDate = Number.Round(Duration.TotalSeconds(DateTime.LocalNow() - #datetime(1970,1,1,0,0,0))-2592000,0),
        EndDate = Number.Round(Duration.TotalSeconds(DateTime.LocalNow() - #datetime(1970,1,1,0,0,0)),0),
        
        Source = Web.Contents("https://finance.yahoo.com/quote/EEM/historyperiod1=" & Text.From(StartDate) & "&period2=" & Text.From(EndDate) & "&interval=1d&filter=history&frequency=1d&includeAdjustedClose=true")
       
    in
        Source

     

    Pat