DateTime with Unity3D and Javascript


#pragma strict

var oraOggi : String;
var dataOggi : String;

function Start () {
	SystemData();
}

function Update () {

}

function SystemData(){
var t: System.DateTime = System.DateTime.Now;

     oraOggi = String.Format("{0:D2}:{1:D2}:{2:D2}", t.Hour, t.Minute, t.Second);
     Debug.Log(oraOggi); // in the Console 13:20:09

     dataOggi = String.Format("{0:D2}-{1:D2}-{2:D2}", t.Day, t.Month, t.Year);
     Debug.Log(dataOggi); // in the Console 22-09-15

}// END SystemData()