5 个解决方案
#1
DateTime now = DateTime.Now;
byte[] bts = BitConverter.GetBytes(now.ToBinary());
DateTime rt = DateTime.FromBinary(BitConverter.ToInt64(bts, 0));
byte[] bts = BitConverter.GetBytes(now.ToBinary());
DateTime rt = DateTime.FromBinary(BitConverter.ToInt64(bts, 0));
#2
还有这么用的?学习~
#3
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace CS.sql_manage
{
public partial class TestCode : Form
{
public TestCode()
{
InitializeComponent();
}
private void TestCode_Load(object sender, EventArgs e)
{
// DateTime dt = DateTime.Now;
// this.textBox1.Text = string.Format("{0:yyyyMMdd}",dt);
//this.textBox1.Text = dt.ToString("yyyyMMddHHmmss");
DateTime now = DateTime.Now;
byte[] bts = BitConverter.GetBytes(now.ToBinary());
DateTime rt = DateTime.FromBinary(BitConverter.ToInt64(bts, 0));
this.textBox1.Text = rt.ToString("yyyyMMddHHmmss");
}
}
}
测试通过
#4
要用在网络上?
为什么不用BinaryStream
为什么不用BinaryStream
#5
时间处理的函数很多 条条大路
#1
DateTime now = DateTime.Now;
byte[] bts = BitConverter.GetBytes(now.ToBinary());
DateTime rt = DateTime.FromBinary(BitConverter.ToInt64(bts, 0));
byte[] bts = BitConverter.GetBytes(now.ToBinary());
DateTime rt = DateTime.FromBinary(BitConverter.ToInt64(bts, 0));
#2
还有这么用的?学习~
#3
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace CS.sql_manage
{
public partial class TestCode : Form
{
public TestCode()
{
InitializeComponent();
}
private void TestCode_Load(object sender, EventArgs e)
{
// DateTime dt = DateTime.Now;
// this.textBox1.Text = string.Format("{0:yyyyMMdd}",dt);
//this.textBox1.Text = dt.ToString("yyyyMMddHHmmss");
DateTime now = DateTime.Now;
byte[] bts = BitConverter.GetBytes(now.ToBinary());
DateTime rt = DateTime.FromBinary(BitConverter.ToInt64(bts, 0));
this.textBox1.Text = rt.ToString("yyyyMMddHHmmss");
}
}
}
测试通过
#4
要用在网络上?
为什么不用BinaryStream
为什么不用BinaryStream
#5
时间处理的函数很多 条条大路