Skip to main content
 首页 » 编程设计

C# 时间字符串转16进制字符串

2022年07月19日130bhlsheji

        private void Form1_Load(object sender, EventArgs e)        

{            

   string timeStr = DateTime.Now.ToLongTimeString().ToString();           

    string[] arr = timeStr.Split(':');            

  string str = (int.Parse(arr[0])).ToString("X") + " " + (int.Parse(arr[1])).ToString("X") + " " + (int.Parse(arr[2])).ToString("X");

        label1.Text = str;        

}


本文参考链接:https://www.cnblogs.com/xihong2014/p/11869736.html