Unity获取系统时间

来源:互联网 发布:怎样注册网络 编辑:程序博客网 时间:2024/06/05 20:43

Unity系统时间

<span style="font-size:14px;">using UnityEngine;using System;using System.Collections;public class Test : MonoBehaviour{    void Update()    {        Debug.Log("W now  " + System.DateTime.Now);        //当前时间(年月日时分秒)        Debug.Log("W utc  " + System.DateTime.UtcNow);     // 当前时间(年月日时分秒)        Debug.Log("W year  " + System.DateTime.Now.Year);  //当前时间(年)        Debug.Log("W month   " + System.DateTime.Now.Month); //当前时间(月)        Debug.Log("W day   " +  System.DateTime.Now.Day);    // 当前时间(日)        Debug.Log("W h    " + System.DateTime.Now.Hour);  // 当前时间(时)        Debug.Log("W min   " + System.DateTime.Now.Minute);  // 当前时间(分)        Debug.Log("W second   " + System.DateTime.Now.Second); // 当前时间(秒)    }}</span>


1 0