找回密码
 立即注册
查看: 4156|回复: 66

[脚本] Unity3d 获取当前系统时间

[复制链接]
发表于 2012-6-11 23:43 | 显示全部楼层 |阅读模式
  1. var gSkin:GUISkin;var str="";
  2. var Months:String[]=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"];
  3. var Days:String[]=
  4. ["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(){if(gSkin)GUI.skin=gSkin;      
  8. GUILayout.Box("本地日期时间:"+System.DateTime.Now);//本地时间,12小时制的        
  9. GUILayout.Box("军事日期时间:"+System.DateTime.Now.ToString("yyyyMMddHHmmss"));        
  10. GUILayout.Box("UTC日期时间:"+System.DateTime.UtcNow);//UTC时间
  11. GUILayout.SelectionGrid(System.DateTime.Now.Month-1,Months,3);        
  12. GUILayout.SelectionGrid(System.DateTime.Now.Day-1,Days,10);        
  13. GUILayout.Box(str+dNow.Now.Year+"年"+dNow.Now.Month+"月"+dNow.Now.Day+" 日"+"        "+dNow.Now.Hour+"时"+dNow.Now.Minute+"分"+dNow.Now.Second+"秒");}
复制代码
发表于 2014-5-15 14:15 | 显示全部楼层
学习学习 学习
发表于 2017-2-14 13:34 | 显示全部楼层
很不错
发表于 2017-2-14 14:18 | 显示全部楼层
楼主是超人
发表于 2017-2-14 13:49 | 显示全部楼层
顶顶多好
发表于 2017-2-14 13:41 | 显示全部楼层
难得一见的好帖
发表于 2017-2-14 13:52 | 显示全部楼层
说的非常好
发表于 2017-3-13 15:30 | 显示全部楼层
很不错
发表于 2017-3-13 15:50 | 显示全部楼层
顶顶多好
发表于 2017-3-13 16:21 | 显示全部楼层
难得一见的好帖
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-11-22 01:18 , Processed in 0.183441 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表