Answer the question
In order to leave comments, you need to log in
How to get difference in milliseconds from 2 dates?
Here is a method I wrote from examples on the network
private float GetTimeDiff(string stringDate){
DateTime TimeNow = DateTime.UtcNow;
TimeSpan diff = TimeNow - System.DateTime.Parse(stringDate);
int seconds = diff.Seconds;
int milliseconds = diff.Milliseconds;
float returnDiff = (float)seconds + ((float)milliseconds / 1000);
return returnDiff;
}
.....
float diff = GetTimeDiff("2020-08-09 20:00:00");
Debug.Log(diff);
.....
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question