using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class TimeManager : UpdateManager { public Text timetext; public string gxlj= "HH:mm:ss"; public override void updateData() { base.updateData(); DateTime now = DateTime.Now; // 获取当前本地时间 string dateString = now.ToString("yyyy-MM-dd"); // 格式化日期部分 string timeString = now.ToString(gxlj); // 格式化时间部分 string dateTimeString = dateString + " " + timeString; // Debug.Log("dateTimeString==>" + dateTimeString); timetext.text = dateTimeString.ToString(); } }