using UnityEngine; using System.Collections; public class Stime : MonoBehaviour { UILabel mTimeLab; void Start () { mTimeLab = this.GetComponent<UILabel>(); } void Update () { updateTime(); } void updateTime() { int hour = System.DateTime.Now.Hour; int min = System.DateTime.Now.Minute; string sHour = hour < 10 ? "0" + hour : hour.ToString(); string sMin = min < 10 ? "0" + min : min.ToString(); mTimeLab.text = sHour + ":" + sMin; } }
时间: 2024-10-08 01:58:09