- Home /
How to Work Out Time Passed in Seconds (Using System.DateTime.Now)?
Hi, this is more a maths related question, rather than a programming one, but code is greatly appreciated.
I have a float value, of 86400, which I'll call Time - the total amount of seconds in a day. I need to use System.DateTime.Now.Hour, Minute, Second and convert them into a float value that fits within Time.
I've read online that you can just do 24*60*60, but that's not giving me the correct results, so I'm posting it here.
Thanks in advance!
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by TSCSimulation_AH · Dec 12, 2018 at 08:24 AM
Got it. For those in my situation:
 float hour = System.DateTime.Now.Hour * 3600;
 float minute = System.DateTime.Now.Minute * 60;
 float second = System.DateTime.Now.Second;
 float total = hour + minute + second;
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                