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
-1
votes
2 answers

Converting an array of floats to datetime

I am struggling to convert an array of floats (numbers with decimal places) to datetime. What I have is a huge array with non-integers (like those produced with Microsoft Excel) that denotes days after a certain date. If I do it for only 1 float…
-1
votes
1 answer

Convert sin calculation to use per-frame delta

I currently have a function that updates a value using the sin function, and a timeFactor double that keeps track of how much time has passed since the program started: double timeFactor; double delta; while(running) { delta = currentTime -…
user1765354
  • 347
  • 1
  • 5
  • 21
-1
votes
1 answer

Can understand output [python]

this is my first post so I apologize for the formatting. I got that piece of code I wrote for college and it's for calculating hoy many days, hours and minutes have I lived. def min_vivido(fech_act,fec_nac): anosViv = (fech_act%10000) -…
sebaLinares
  • 485
  • 5
  • 17
-1
votes
1 answer

Python / Check if sliced date is a delta from current date?

I have data, which I've formatted and sliced in the following format: currentTime = datetime.now().strftime("%m-%d-%Y") which returns dates such as this: 09-20-2017 I want to compare this date, or rather the timedelta of this date some time period…
Sam G
  • 3
  • 5
-1
votes
2 answers

Timestamp to long datetime

I have this function that converts a timestamp to a datetime object that says either; "Today at 10:56 pm" or "Yesterday at 1:06 am" or others... I'm having some issues with it currently. otherdate = 1504246379 now = time.time() if otherdate: dt…
Denis Angell
  • 343
  • 1
  • 4
  • 14
-1
votes
1 answer

Adding timedelta object to datetime

My timedelta object looks like this: txdelta = 00:30:00. I want to add it to a datetime object but it consistently isn't working: from datetime import datetime, date, time, timedelta localdt = datetime.combine(datetime.strptime('2015-06-18',…
curious_cosmo
  • 1,184
  • 1
  • 18
  • 36
-1
votes
1 answer

How to calculate the difference between two dates in hours with java?

I have to calculate the difference bettween two dates where is one from the user`s input and the other is the current time. Here is what I have so far: long time2 = System.currentTimeMillis(); System.out.print("Enter Time-in(hh:mm)"); String start =…
khavirna
  • 21
  • 5
-1
votes
1 answer

Python 3 How can I convert user input of MPH and Miles into timedelta?

I apologize if my question is a little confusing, because to be honest I am not 100% sure what I am trying to do either. I have a program that asks the user for a departure date and departure time, so I will end up with an input of something -like…
-1
votes
1 answer

how to convert pd.to_timedelta() to time() object?

I need get 0 days 08:00:00 to 08:00:00. code: import pandas as pd df = pd.DataFrame({ 'Slot_no':[1,2,3,4,5,6,7], 'start_time':['0:01:00','8:01:00','10:01:00','12:01:00','14:01:00','18:01:00','20:01:00'],…
-1
votes
1 answer

A strange behaviour regarding filtering a dataframe based on the datatime column

I have a strange situation with the code below. As you see there seem to be no data with timestamp_day value smaller than the indicated value in the code below: print myDF.shape > (447609, 20) print myDF[myDF['timestamp_day'] < timedelta(2014, 7,…
renakre
  • 8,001
  • 5
  • 46
  • 99
-1
votes
1 answer

stopping delta time c#

I'm trying to display 3 times at once for a turn based game. The first time is total time being counted down. The other two timers shows countdown time for each player. I also have a boolean value being checked from another class to see which turn…
-1
votes
3 answers

python: adding any number of days to date

I am hoping someone can point me in the right direction in working with dates and timedelta. my understanding is that to add any number (ex: 10 days) to a date, you need to convert it to a timedelta. if that is correct, how can I add any number to a…
antonio_zeus
  • 477
  • 2
  • 11
  • 21
-1
votes
3 answers

Python datetime timedelta issues with leading 0 in days parm

Ok So it looks like there may be a bug or something is missing in the documentation. If you add a leading 0 to the days parm for example, you will get a different result than without it, See sample: >>> import datetime >>> datetime.date.today() -…
radtek
  • 34,210
  • 11
  • 144
  • 111
-1
votes
1 answer

Limit Frame per second

Hi all I'm attempting to limit my FPS to 30 with the below code, but I'm not sure it's working. while (runthread){ c = null; timestart = System.currentTimeMillis(); //Get time at start of loop for…
Zippy
  • 3,826
  • 5
  • 43
  • 96
-1
votes
1 answer

How to calculate current velocity using Euler integration

I want to know if I convert formula correctly. I'm not sure of that. I know: force = mass * acceleration acceleration = (Velocity - previousVelocity) / deltaTime acceleration = force / mass So: (Velocity - previousVelocity) / deltaTime = Force /…
Jean-Francois Gallant
  • 13,583
  • 6
  • 20
  • 24