当前位置: 首页 > news >正文

做ui什么图库网站好呀网络服务器搭建与配置

做ui什么图库网站好呀,网络服务器搭建与配置,网站后台 页面内容不显示,樟木头镇网站建设公司Unity中获取时间戳、日期、时间、毫秒、秒以相互转换、自定义格式时间 介绍时间戳是什么什么时候用时间戳 获取时间获取当前时间获取时间戳日期转时间戳时间戳转日期将时间戳转换为多久之前星期自定义格式时间 总结 介绍 这里附带一个时间戳和时间转换的网址 时间戳是什么 时… Unity中获取时间戳、日期、时间、毫秒、秒以相互转换、自定义格式时间 介绍时间戳是什么什么时候用时间戳 获取时间获取当前时间获取时间戳日期转时间戳时间戳转日期将时间戳转换为多久之前星期自定义格式时间 总结 介绍 这里附带一个时间戳和时间转换的网址 时间戳是什么 时间戳就是从1970年1月1日0时0分0秒起到现在的总毫秒数为什么时1970/1/1/00:00:00因为第一台计算机发明时间是这个时间所以时间戳诞生了。 什么时候用时间戳 比如说你要做一些时间相关的功能那么基本都会用到时间戳。而且时间戳是精确的比如说要做计时、宝箱倒计时、账号禁言、封号等相关问题你请求服务器的数据一般都是通过时间戳来获取具体时间。而且如果与服务器通讯也可以通过时间戳来做一个请求响应时间。 获取时间 获取当前时间 //北京时间 DateTime date1 DateTime.Now; Debug.LogError(北京时间 date1);//国际时间 DateTime date2 DateTime.UtcNow; Debug.LogError(国际时间 date2);获取时间戳 //时间戳方法一 long now1 DateTime.UtcNow.Ticks; Debug.LogError(当前时间戳 now1);//时间戳方法二 long now2 DateTime.Now.ToUniversalTime().Ticks; Debug.LogError(当前时间戳 now2);日期转时间戳 //方法一 TimeSpan st1 DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0); Debug.LogError(日期转为毫秒时间戳: Convert.ToInt64(st1.TotalMilliseconds)); Debug.LogError(日期转为秒时间戳: Convert.ToInt64(st1.TotalSeconds)); Debug.LogError(日期转为分钟时间戳: Convert.ToInt64(st1.TotalMinutes)); Debug.LogError(日期转为小时时间戳: Convert.ToInt64(st1.TotalHours)); Debug.LogError(日期转为天时间戳: Convert.ToInt64(st1.TotalDays)); //方法二 TimeSpan st2 DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0); Debug.LogError(日期转为毫秒时间戳: Convert.ToInt64(st2.TotalMilliseconds)); Debug.LogError(日期转为秒时间戳: Convert.ToInt64(st2.TotalSeconds)); Debug.LogError(日期转为分钟时间戳: Convert.ToInt64(st2.TotalMinutes)); Debug.LogError(日期转为小时时间戳: Convert.ToInt64(st2.TotalHours)); Debug.LogError(日期转为天时间戳: Convert.ToInt64(st2.TotalDays));//方法三 double tS1 ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000); Debug.LogError(日期转为时间戳: tS1);//方法四 double tS2 ((DateTime.UtcNow.Ticks - 621355968000000000) / 10000); Debug.LogError(日期转为时间戳: tS2);时间戳转日期 //方法一DateTime startTime1 TimeZoneInfo.ConvertTime(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc), TimeZoneInfo.Local);DateTime dt1 startTime1.AddMilliseconds(1698766775000);//传入的时间戳Debug.LogError(时间戳转时间: dt1);//方法二DateTime startDateTime TimeZoneInfo.ConvertTimeFromUtc(new DateTime(1970, 1, 1, 0, 0, 0), TimeZoneInfo.Local);long targetTimeStamp ((long)1698766775000 * 10000);TimeSpan targetTS new TimeSpan(targetTimeStamp);DateTime targetDateTime startDateTime.Add(targetTS);Debug.LogError(时间戳转时间: targetDateTime);//方法三DateTime startTime3 TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));DateTime dt3 startTime3.AddTicks(1698766775000 * 10000);//传入的时间戳Debug.LogError(时间戳转时间: dt3);将时间戳转换为多久之前 void Start(){Debug.LogError(GetTimeLongAgo(20));Debug.LogError(GetTimeLongAgo(3000));Debug.LogError(GetTimeLongAgo(50000));Debug.LogError(GetTimeLongAgo(864000));Debug.LogError(GetTimeLongAgo(25920000));Debug.LogError(GetTimeLongAgo(61104000));}/// summary/// 将秒数时间戳转换为多久之前。传入时间戳t(t 当前时间戳() - 指定时间的时间戳 )/// /summary/// param namet/param/// returns/returnspublic string GetTimeLongAgo(double t){string str ;double num;if (t 60){str string.Format({0}秒前, t);}else if (t 60 t 3600){num Math.Floor(t / 60);str string.Format({0}分钟前, num);}else if (t 3600 t 86400){num Math.Floor(t / 3600);str string.Format({0}小时前, num);}else if (t 86400 t 2592000){num Math.Floor(t / 86400);str string.Format({0}天前, num);}else if (t 2592000 t 31104000){num Math.Floor(t / 2592000);str string.Format({0}月前, num);}else{num Math.Floor(t / 31104000);str string.Format({0}年前, num);}return str;}星期 //方案一string[] Day new string[] { 星期日, 星期一, 星期二, 星期三, 星期四, 星期五, 星期六 };string week Day[Convert.ToInt32(DateTime.Now.DayOfWeek.ToString(d))].ToString();Debug.LogError(week);//方案二Debug.LogError(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek));//方案三Debug.LogError(DateTime.Today.DayOfWeek.ToString());自定义格式时间 DateTime dateTime DateTime.Now; string strNowTime string.Format({0:D}-{1:D}-{2:D}-{3:D}-{4:D}-{5:D}-{6:D}, dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second, dateTime.Millisecond);Debug.LogError(strNowTime);总结 这里其实还有很多中方式上面知识其中的一些基本是够用了欢迎评论区补充
http://www.huolong8.cn/news/385187/

相关文章:

  • 怎么制作网站步骤wordpress分享到微信二维码
  • 中卫网站设计厂家装修设计灵感网站
  • 网站建设开发心得汉中市网站建设公司
  • 免费cms网站静态手机网站基础
  • 一个在线做笔记的网站买网站服务器吗
  • 岳阳网站网站建设哈什么网一个网站做ppt
  • 怎样让网站优化的方式网站开发各个文件
  • 哪个平台做网站比较好免费 网站 手机
  • 阿里企业网站托管ui设计培训机构有用吗
  • 404 not found网站航空港建设局网站
  • 济南网站建设方案报价长沙seo网络公司
  • 有口碑的中山网站建设广东住房和城乡建设厅网站造价
  • 美工宝盒网站网站开发三大框架
  • 厦门旋挖建筑公司网站获取网站目录下所有文件
  • 做网站绿标wordpress app主题
  • 做网站制作的公司php免费源码网站
  • ps做网站标签乡村门户网站建设
  • 食品网站建设方案上海建设行政主管部门政务网站
  • 微信订阅号关键网站名城苏州网首页
  • 长链接转短链接生成器搜索引擎优化原理
  • 汽贸公司网站建设中疾控新冠最新消息
  • 谁能给做网站济南住房和城乡建设部网站
  • 网站更新 缓存手机网站html声明
  • 网站建设与维护一般需要多少钱每年wordpress 环境配置
  • 湘潭交通网站哈尔滨菜牌制作
  • 怎样在阿里巴巴做网站柬埔寨网站建设
  • 相城网站建设石家庄制作网站
  • 辽宁建设工程招标网站徐东网站建设
  • 江西建网站网站建设情况存在问题
  • 网站安全管理制度建设珠海网站建设技术托管