📜  日期时间统一 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:02.661000             🧑  作者: Mango

代码示例1
using System;

//then inside your public class
public static DateTime theTime = DateTime.Now; //the time
[SerializeField] private string date = theTime.ToString("yyyy-MM-dd\\Z"); //convert time and date to string
[SerializeField] private string time = theTime.ToString("HH:mm:ss");
[SerializeField] private string dateTime = theTime.ToString("yyyy-MM-dd\\THH:mm:ss\\Z");