OT: date re-calc

Started by stanl, October 02, 2020, 07:03:20 AM

Previous topic - Next topic

stanl

This relates to thread about Yahoo finances, the last code I updated did a conversion of json to bar-delimited. One of the sections was


dividendDate|1599696000


not sure the number is a Unix Timestamp as it appears to be in milli-seconds not seconds. Also think the huge math extender has to be brought into play. In any event, be interested in anyone suggesting a udf to return a WB formatted date as mm/dd/yyyy.

Code (WINBATCH) Select


data = "dividendDate|1599696000"
d = ItemExtract(2,data,"|")
retDate = myudf(d)  ; what is myudf()

td

Fortunately, it isn't 2038 yet and dividends aren't being issued in that time frame yet so this should work.

Code (winbatch) Select
Ymd = TimeAdd('1970:01:01:00:00:00', '00:00:00:00:00:001599696000')
DT = TimeFormat(Ymd,"MM/dd/yyyy")   
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

stanl

So it was mili-seconds... wish they could make up their mind :o