I have a timestamp and I want to add 100 miliseconds to it
Question:
this is a python / pandas data type question.
So lets say I have a timestamp, which is in STRING format:
1675242910384942479
I would like to know the timestamp + 100 milliseconds.
Ideally I would like a function take takes in N (number of miliseconds) and timestamp and returns timestamp + N.
Answers:
Since your timestamp is in nanoseconds, you need to add the milliseconds multiplied by 1,000,000
def add_ms(timestamp, ms):
return int(timestamp) + 1000000 * ms
this is a python / pandas data type question.
So lets say I have a timestamp, which is in STRING format:
1675242910384942479
I would like to know the timestamp + 100 milliseconds.
Ideally I would like a function take takes in N (number of miliseconds) and timestamp and returns timestamp + N.
Since your timestamp is in nanoseconds, you need to add the milliseconds multiplied by 1,000,000
def add_ms(timestamp, ms):
return int(timestamp) + 1000000 * ms