GetSystemTimers.cs 661 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class GetSystemTimers : MonoBehaviour
  7. {
  8. // Start is called before the first frame update
  9. private Text timerText;
  10. void Start()
  11. {
  12. timerText = this.GetComponent<Text>();
  13. }
  14. // Update is called once per frame
  15. void Update()
  16. {
  17. GetSystemTimes();
  18. }
  19. private void GetSystemTimes()
  20. {
  21. DateTime NowTime = DateTime.Now.ToLocalTime();
  22. //timerText.text = NowTime.ToString("yyyy年-MM月-dd日 HH:mm:ss");
  23. timerText.text = NowTime.ToString("dd日 HH:mm:ss");
  24. }
  25. }