Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

How to get current System time in unity using java script?

Discussion in 'iOS and tvOS' started by jpsubbarayalu, Jul 28, 2010.

  1. jpsubbarayalu

    jpsubbarayalu

    Joined:
    Jul 13, 2010
    Posts:
    65
    Hi All,

    In my project i want to set the Timer[Like digital clock(00:00)].After launching my application it should take automatically system time and display in my application.Now i can able to set the timer.But i want to set current system time.For this i tried.But i didn't get the solution.If anybody know about this stuff,please share with me.


    Thanks in Advance,
     
  2. jpsubbarayalu

    jpsubbarayalu

    Joined:
    Jul 13, 2010
    Posts:
    65
    Hi All,

    If anybody know about this stuff,please reply.i am struggling this past two days.Please reply.




    Thanks
     
  3. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    Code (csharp):
    1.  
    2. function Update() {
    3.  var dt : System.DateTime = System.DateTime.Now;
    4.  var h : int = dt.Hour;
    5.  var m : int = dt.Minute;
    6.  var s : int = dt.Second;
    7. }
    8. [quote]
    9. I think this should work for you.
    10.  
    11. Harry
    12. [/quote]
     
  4. jpsubbarayalu

    jpsubbarayalu

    Joined:
    Jul 13, 2010
    Posts:
    65
    Hi,

    Its functioning very well.Thank you so much.