- Home /
javascript System time and date?
hello. How do you get the System-time in javascript? for example put it into a vareable:
pragma strickt
ar time=0; function Update () { time = System.Time <-- I imagine somthing like this... }
Answer by aldonaletto · Jan 15, 2013 at 10:32 PM
You can use the .NET/Mono class System.DateTime.Now - the example below should be attached to a GUIText object, and shows the current hour/minute/seconds:
 #pragma strict
 
 function Update () {
     var t: System.DateTime = System.DateTime.Now;
     guiText.text = String.Format("{0:D2}:{1:D2}:{2:D2}", t.Hour, t.Minute, t.Second);
 }
There are other properties in DateTime, like Month, Day, Year etc. - take a look at the MSDN docs.
Answer by cdrandin · Jan 15, 2013 at 10:13 PM
Google is your friend, not an enemy. System.DateTime.Now to get the current time on your local system. This should work hopefully.
Answer by mezzostatic · Jan 29, 2017 at 09:46 AM
Using realtimesincestartup i have:
 var t = TimeSpan.FromSeconds(Time.realtimeSinceStartup);
 
 status3 =  (pixelsFixed - pixelsecond).ToString() + "  more non-manifold pixels found, time is "+    String.Format("{0:D2}:{1:D2}:{2:D2}", t.Hours, t.Minutes, t.Seconds) +" minutes ";
Your answer
 
 
             Follow this Question
Related Questions
Help With Quickest TimeScore 0 Answers
Time.deltaTime not consistent over time 1 Answer
Breathing sound effect using timers 1 Answer
Updating an array indices dynamically 2 Answers
Constant Yield Time 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                