Closed markorapaic closed 8 years ago
Nevermind, looks like it was a mixture of a poorly formatted CSV (using dd/mm/yy
instead of dd/mm/yyyy
and convoluted code. I'm now using this, and it seems to be working:
def ref_date_epoch():
parseDate = parse(row[2])
getEpoch = parseDate.epoch
shiftEpoch = epoch(getEpoch).shift("US/Eastern")
convertEpoch = shiftEpoch.epoch
testing = int(convertEpoch)
return "{testing}000".format(testing=testing)
Right, so I've just uploaded about 26,000 notes via this HubSpot endpoint, and i've noticed that a bunch of the uploaded notes have very wrong timestamps (for example instead of being back-dated, or up-to-date, they're flung far into the future).
I've traced the issue back to a portion of my code which uses Delorean to make it easier to parse and convert times to epoch timestamps. The issue seems to be that, when I use variable interpolation via the
.format()
function - it seems to somehow change something.Example 1 - No interpolation.
The above example returns
1398754800000
as the epoch timestamp, which will convert into the correct date -29/04/2014
.Example 2 - With interpolation.
This time, the above example returns
1597302000000
as the epoch timestamp, which is really, really wrong - it ends up being13/08/2020
. To elaborate, thedatestr
argument is accepting the listrow[2]
which references the index of a row in a csv which contains the date.Example 3. Without the
.format()
function:This still returns
1597276800000
. It seems that the mere act of indirectly referencing the date seems to change the time. What gives?