取系统时间

  1. var gSkin:GUISkin;

  2. var str="";
  3. var        Months:String[]=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"];
  4. var        Days:String[]= ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"];
  5. var        dNow:System.DateTime;
  6. var i=0;

  7. function OnGUI()
  8. {if(gSkin)GUI.skin=gSkin;
  9.         GUILayout.Box("本地日期时间:"+System.DateTime.Now);//本地时间,12小时制的
  10.         GUILayout.Box("军事日期时间:"+System.DateTime.Now.ToString("yyyyMMddHHmmss"));
  11.         GUILayout.Box("UTC日期时间:"+System.DateTime.UtcNow);//UTC时间
  12.        
  13. GUILayout.SelectionGrid(System.DateTime.Now.Month-1,Months,3);
  14.         GUILayout.SelectionGrid(System.DateTime.Now.Day-1,Days,10);
  15.        
  16.         GUILayout.Box(str+dNow.Now.Year+"年"+dNow.Now.Month+"月"+dNow.Now.Day+" 日"+"        "+dNow.Now.Hour+"时"+dNow.Now.Minute+"分"+dNow.Now.Second+"秒");
  17.        
  18. }

你可能感兴趣的:(系统时间)