Is there an example of using `datetime` to create ...
# troubleshooting
k
Is there an example of using
datetime
to create a date-time field in inline stream maps based on another field? I want to create a new field based on the epoch timestamp we have in the data, but I could not make it work.
e
Hi @Kyunghwan Choi. What did you try so far?
k
updatedAt: datetime(int(record(['somefield'])) or updatedAt: datetime(record['somefield]') or updatedAt: datetime.datetime(both of above) etc. I think they were all throwing errors.
e
ok, and what's an example value of
somefield
?
k
it's a int field, epoch time in microseconds
e
I don't think so. The function you're probably looking for is datetime.datetime.fromtimestamp:
updatedAt: datetime.datetime.fromtimestamp(somefield)
k
let me try that! Thank you.
👍 1