29 lines
672 B
C#
29 lines
672 B
C#
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using TMPro;
|
||
using UnityEngine;
|
||
|
||
public class DisplayDayOfWeek : MonoBehaviour
|
||
{
|
||
public TextMeshProUGUI text;
|
||
// Start is called before the first frame update
|
||
void Start()
|
||
{
|
||
|
||
}
|
||
|
||
// Update is called once per frame
|
||
void Update()
|
||
{
|
||
// 获取当前日期
|
||
DateTime currentDate = DateTime.Now;
|
||
|
||
// 获取星期几(格式:星期一, 星期二...)
|
||
string dayOfWeek = currentDate.ToString("dddd", System.Globalization.CultureInfo.GetCultureInfo("zh-CN"));
|
||
|
||
// 显示星期几
|
||
text.text =dayOfWeek;
|
||
}
|
||
}
|