40 lines
837 B
C#
40 lines
837 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);
|
|
}
|
|
}
|
|
}
|