找回密码
 立即注册
楼主: 辣条

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

[复制链接]
发表于 2012-8-12 23:31 | 显示全部楼层 |阅读模式
本帖最后由 辣条 于 2012-8-12 23:32 编辑
  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",   
  5. "21","22","23","24","25","26","27","28","29","30","31"];   
  6. var dNow:System.DateTime;   
  7. var i=0;   
  8. function OnGUI()   
  9. {if(gSkin)GUI.skin=gSkin;   
  10.         GUILayout.Box("本地日期时间:"+System.DateTime.Now);//本地时间,12小时制的   
  11.         GUILayout.Box("军事日期时间:"+System.DateTime.Now.ToString("yyyyMMddHHmmss"));   
  12.         GUILayout.Box("UTC日期时间:"+System.DateTime.UtcNow);//UTC时间   
  13. GUILayout.SelectionGrid(System.DateTime.Now.Month-1,Months,3);   
  14.         GUILayout.SelectionGrid(System.DateTime.Now.Day-1,Days,10);   
  15.         GUILayout.Box(str+dNow.Now.Year+"年"+dNow.Now.Month+"月"+dNow.Now.Day+" 日"+"        "+dNow.Now.Hour+"时"+dNow.Now.Minute+"分"+dNow.Now.Second+"秒");   
  16. }  

复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
发表于 2012-11-12 15:28 | 显示全部楼层
看到这帖子真是高兴!
发表于 2012-11-12 20:38 | 显示全部楼层
Mark一下,用到的时候好找
发表于 2012-12-12 09:02 | 显示全部楼层
{:soso_e185:}GOOD!
发表于 2017-2-13 17:10 | 显示全部楼层
很不错
发表于 2017-2-13 17:12 | 显示全部楼层
楼主是超人
发表于 2017-2-13 16:53 | 显示全部楼层
难得一见的好帖
发表于 2017-2-13 17:35 | 显示全部楼层
说的非常好
发表于 2017-2-13 16:54 | 显示全部楼层
LZ真是人才
发表于 2017-3-3 17:12 | 显示全部楼层
顶顶多好
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-11-22 01:53 , Processed in 0.176439 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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