例如2005-09-29 17:27:18转换成32位的无符号32位整型。
在如何把32位的无符号32位整型转换回来??
验证后马上给分

解决方案 »

  1.   

    DateTime -> long:
    DateTime dt = DateTime.Now;
    long l = dt.Ticks;long -> DateTime:
    long l = 223456L;
    DateTime dt = new DateTime(l);long 是64位有符号整数: System.Int64
      

  2.   

    我不是要long型是32位的无符号32位整型
      

  3.   

    2005-09-29 17:27:18 -〉2,005,0929,172,718?这样的数字?Int32类型最大长度:2,147,483,647,无符号类型也就*2而已,远远不能满足你的需要。所以请乖乖的按照wuyi8808(空间) 所说的来做
      

  4.   

    // long -> HexString:
    long   l = 1127938323L;
    string s = l.ToString("X");// HexString -> long:
    string s = "433af913";
    long   l = long.Parse(s, System.Globalization.NumberStyles.HexNumber);
      

  5.   

    using System;class Test
    {
      // Reference DateTime
      static readonly DateTime DateTime0 = new DateTime(1900, 1, 1);  // DateTime -> UInt32
      static UInt32 FromDateTime(DateTime dt)
      {
        return (UInt32)(dt - DateTime0).TotalSeconds;
      }  // UInt32 -> DateTime
      static DateTime FromUInt32(UInt32 n)
      {
        return DateTime0.AddSeconds(n);
      }  // Test
      static void Main()
      {
        DateTime dt0 = DateTime.Now;
        UInt32 n = FromDateTime(dt0);
        Console.WriteLine(n);
        DateTime dt1 = FromUInt32(n);
        Console.WriteLine(dt1);
      }
    }