. NET Get network Time (Beijing time) 24-hour system

Source: Internet
Author: User

<summary>     //Update system time     //</summary>      public CLA SS UpdateTime      {        //Set system time API functions          [Dl Limport ("kernel32.dll")]          private static extern bool Setlocaltime (ref SYSTEMTIME time);            [StructLayout (layoutkind.sequential)]          Private struct SYSTEMTIME          {             public short Year              public short month;              public short dayOfWeek;              public short day;              public short hour;              public short minute;            &NBSP; public short second;              public short milliseconds;         }           //<summary>         //Set up system time         //</summary>         //< param name= "DT" > Required time </param>         //<returns> return system Time setting state, true for success, False for failure </returns>          public static bool SetDate (DateTime DT)      &NB Sp   {             SYSTEMTIME St;            &NBS P   St.year = (short) dt. year;              St.month = (short) dt. Month;              St.dayofweek = (short) dt. DayOfWeek;              St.day = (short) dt. Day;        &NBsp     St.hour = (short) dt. Hour;              St.minute = (short) dt. Minute;              St.second = (short) dt. Second;              st.milliseconds = (short) Dt.millisecond;              BOOL RT = Setlocaltime (ref st);              return RT;         }     }  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.