DateTime with countdown
Hi,
I'm trying to make a script that counts down to a certain date and time before continuing to the next "level". This is what I have so far, the countdown seems to work, but I'm not sure. Any help would be greatly appreciated!
 using UnityEngine;
 using System.Collections;
 using System;
 
 public class clock : MonoBehaviour
 {
     public int getSecondsLeft(int hours,int minutes ,int seconds) {
         DateTime target = new DateTime(11,41,00,hours,minutes,seconds);
         DateTime now = System.DateTime.Now;
         int targetSec = target.Hour*60*60 + target.Minute*60 + target.Second;
         int nowSec = now.Hour * 60 * 60 + now.Minute * 60 + now.Second;
 
         //Get the difference in seconds
         int diff = targetSec - nowSec;
         float test = diff;
         if (test <= 0) {
             Application.LoadLevel("VRVideo");
         }
         Debug.Log(test);
         return diff;
 
     }
 }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
How to create a timer that counts DOWN to the nearest real-time hour? 0 Answers
How to make my game stop once the timer meets zero in unity. 1 Answer
how can i make device clock system using datetime and make life system? 0 Answers
Timer Countdown Pop Up Screen Before Scene "Starts" Please Help!! 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                