RT这样的
我有一个ulong类型的变量a,这个a的说明是:
8个字节,从高到低依次为:年(实际年份-2000)、月、日、时、分、秒、毫秒(2字节)请问我要怎么才能取出这里面的年月、日、时、分、秒、毫秒 呢··c#
我有一个ulong类型的变量a,这个a的说明是:
8个字节,从高到低依次为:年(实际年份-2000)、月、日、时、分、秒、毫秒(2字节)请问我要怎么才能取出这里面的年月、日、时、分、秒、毫秒 呢··c#
byte[] buffer = BitConverter.ToBytes(a);
int year = BitConverter.ToShort(a, 0);
int month = BitConverter.ToShort(a, 2);类似这样就好
int year = BitConverter.ToShort(a, 0);//然后取字节数据
int month = BitConverter.ToShort(a, 2);
ulong somevalue;
year = somevalue >> 56 + 2000;
month = (somevalue >> 48) % 256;
...