S
S
sbh2020-04-20 15:05:14
Python
sbh, 2020-04-20 15:05:14

How to add seconds to timestamp?

There is a timestamp in the format:
2020-04-13 12:59:59.0

There is a number of seconds, for example:
1126321 You

need to add this number to the timestamp and get a new timestamp, how to do this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dr. Bacon, 2020-04-20
@sbh

Let's try to think, you have two different formats that need to be added, what is usually done for this? That's right, lead to one format. And what are the formats for working with date and time? That's right, datetime and timedelta. What remains in the end is to convert the string to datetime, and the number to timedelta. How to translate? That's right, read the documentation.

M
Miit, 2020-04-20
@Miit

Cry

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question