Questions tagged [timedelta]

Timedelta refers to the difference between two timestamps, which is a measure of elapsed time. It may also specifically refer to the 'timedelta' type in Python.

Timedelta refers to the difference between two timestamps, which is a measure of elapsed time. It may also specifically refer to the timedelta type in Python.

In it is represented by Time.deltaTime which holds the elapsed time between frames and allows to coordinate animations and movement of gameObjects.

It is similar to the TimeSpan structure in .NET.

Other languages may have similar features as well.

See also the and tags.

1357 questions
-3
votes
3 answers

I found a script that counts the days until Monday, but I don't know how to convert result to int

Here is the script: from datetime import datetime, timedelta today = now = datetime.today() today = datetime(today.year, today.month, today.day) print (timedelta(days=7-now.weekday()) + today - now) I need the result to be an int because the…
Rocky
  • 1
  • 1
-3
votes
1 answer

how many minutes left for a multiple of 5(05, 10, 15...) in python

I take the time now, and I need to know how many minutes left for the next multiple minute of 5, for example, I use the function now = datetime.now() and returns datetime.datetime(2019, 8, 2, 9, 33, 5, 478647), in this example, left 2 minutes for…
guilherme
  • 35
  • 6
-3
votes
1 answer

How to check and store particular time-period in Django?

I have to store restaurants on my table in the Django model. Each restaurant has its opening and closing time. For each I have to check if a particular restaurant is open or not with respect to the current time a user search for available…
-4
votes
2 answers

python convert str to timedelta

I want to convert time offsets formatted as str to datetime.timedelta objects, then plot the curve of observations versus time. '5 days, 4:23:52.480000' ; 17.647166 '5 days, 5:56:09.166000' ; 22.916071 '5 days, 8:21:40.261000' ; …
Nabil
  • 1
  • 1
-6
votes
2 answers

Chek format ISO8601 in python

I need to check valid string to convert it in ISO8601. Examples: P2Y6M10D - True P2Y10D - True P15D - True P2Y6MD - False 2Y6M10D - False I can write the code using the "re" module. But I don't think that will work.
-6
votes
1 answer

Python dictionary get index plus insert in right position

I'm trying to implement in Python the following logic. # Variable i = loop (1 to 32) days = dict() if i in days: # if there's already a Key in the dict variable_time = str(days[i]) hours_time = variable_time .split(':')[0] …
user2742861
  • 340
  • 1
  • 8
  • 17
-8
votes
2 answers

Working out time between 7am to 3:30pm - JAVA

I've created this program to calculate the time between startWork and finishWork but I cant seem to figure out how to calculate time... This is my Interface. Just wanting to know a way of approaching this calculation. Thanks
1 2 3
90
91