111,120
社区成员
发帖
与我相关
我的任务
分享 private DateTime BytesToDateTime(byte[] bytes)
{
if (bytes != null && bytes.Length >= 6)
{
int year = 2000 + (int)bytes[0];
int month = (int)bytes[1];
int day = (int)bytes[2];
int hour = (int)bytes[3];
int minute = (int)bytes[4];
int second = (int)bytes[5];
DateTime dt = new DateTime(year, month, day, hour, minute, second);
return dt;
}
else
{
return new DateTime();
}
}
奇怪了,0点之后,日期又变成昨天的日期,到了8点钟之后,日期又自动对了。
我就搞不懂了,我是读取的时钟芯片SD2405ALPI的时间,为什么时钟芯片的时间会出现这种情况呢?
