我正在尝试从字节数组中读取和写入 32 位日期时间值。我设法找到了 64 位版本。有谁知道一种简单的方法来做到这一点,但使用 32 位日期/时间?
//Go from byte array to Time/Date
long utcNowLongBack = BitConverter.ToInt64(utcNowBytes, 0);
DateTime utcNowBack = DateTime.FromBinary(utcNowLongBack);
//Create 32 bit byte array from Time/Date
DateTime utcNow = DateTime.UtcNow;
long utcNowAsLong = utcNow.ToBinary();
byte[] utcNowBytes = BitConverter.GetBytes(utcNowAsLong);
根据https://msdn.microsoft.com/en-us/library/9kkf9tah.aspx
喵喵时光机
至尊宝的传说
相关分类