110,533
社区成员
发帖
与我相关
我的任务
分享
int year = 2000 + Convert.ToInt32(BitConverter.ToString(new byte[1] { bytes[0] }, 0));
int month = Convert.ToInt32(BitConverter.ToString(new byte[1] { bytes[1] }, 0));
int day = Convert.ToInt32(BitConverter.ToString(new byte[1] { bytes[2] }, 0));
int hour = Convert.ToInt32(BitConverter.ToString(new byte[1] { bytes[3] }, 0));
int minute = Convert.ToInt32(BitConverter.ToString(new byte[1] { bytes[4] }, 0));
int second = Convert.ToInt32(BitConverter.ToString(new byte[1] { bytes[5] }, 0));
DateTime dt = new DateTime(year, month, day, hour, minute, second);
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);
DateTime dt = BytesToDateTime(YearArray);
cmd.Parameters.AddWithValue("@d_date", dt); //C# DATATIME变量写到数据库DATE字段
cmd.Parameters.AddWithValue("@d_time", dt); //C# DATATIME变量写到数据库TIME字段