38 lines
831 B
C#
38 lines
831 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine.UI;
|
|
using UnityEngine;
|
|
|
|
namespace YL
|
|
{
|
|
public class Time : MonoBehaviour
|
|
{
|
|
public Text time;
|
|
private int hour;
|
|
private int minute;
|
|
private int second;
|
|
private int year;
|
|
private int month;
|
|
private int day;
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
void Update()
|
|
{
|
|
hour = DateTime.Now.Hour;
|
|
minute = DateTime.Now.Minute;
|
|
second = DateTime.Now.Second;
|
|
year = DateTime.Now.Year;
|
|
month = DateTime.Now.Month;
|
|
day = DateTime.Now.Day;
|
|
|
|
|
|
time.text = string.Format("{0:D4}年{1:D2}月{2:D2}日" + "{3:D2}:{4:D2}:{5:D2}", year, month, day, hour, minute, second);
|
|
}
|
|
}
|
|
}
|