WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: stanl on October 02, 2020, 07:03:20 AM

Title: OT: date re-calc
Post by: stanl on October 02, 2020, 07:03:20 AM
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()
Title: Re: OT: date re-calc
Post by: td on October 02, 2020, 07:58:20 AM
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")   
Title: Re: OT: date re-calc
Post by: stanl on October 02, 2020, 08:20:48 AM
So it was mili-seconds... wish they could make up their mind :o