unity显示获取 年月日周几【日期】
cs
public void ShowDate(Text txt)
{
//txt.text =
DateTime now = DateTime.Now; // 获取当前时间
int year = now.Year; // 获取年份
int month = now.Month; // 获取月份(1-12)
int day = now.Day; // 获取天数(1-31)
DayOfWeek weekday = now.DayOfWeek; // 获取星期几(Sunday - Saturday)
txt.text= year+"年"+ month + "月" + day + "日 星期"+(int)weekday;
//Debug.Log("今天是" + year + "年" + month + "月" + day + "日");
//Debug.Log("今天是星期" + (int)weekday);
}