返回列表 上一主題 發帖

[發問] 請問如何以VBA擷取網站上的資料?

回復 21# ui123

請問這個數值文字如何轉換成日期格式?  謝謝
    period1=1473638400

TOP

本帖最後由 Scott090 於 2017-11-11 19:53 編輯

回復 23# ui123


   
原始網站: https://finance.yahoo.com/quote/AAPL/history?period1=1473638400&period2 ...
ui123 發表於 2017-9-14 16:27



period1=1473638400, period2=1505174400 的數字是 日期的秒數數列值
以VBA計算可得
例如 日期是 "2017/1/20",則 period = datevalue("2017/1/20") * 86400 - 2209190400
其中 一日 有86400  秒, 22091904005這個數字是這個網頁對日期演算的一個常數

可以驗算:
a = (1473638400 + 2209190400) / 86400 = 42625.33333
yyyy = year(a) = 2016
mm  = month(a) = 9
dd = day(a) = 12

所以, 1473638400 這個數字 代表 日期 2016/9/12

以上請參考

TOP

回復  Scott090

原始網站: https://finance.yahoo.com/quote/AAPL/history?period1=1473638400&period2 ...
ui123 發表於 2017-9-14 16:27


請參考:
    http://forum.twbts.com/thread-20288-1-1.html

TOP

        靜思自在 : 要比誰更受誰.不要比誰更怕誰。
返回列表 上一主題