zoukankan      html  css  js  c++  java
  • C#修改电脑时间

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Runtime.InteropServices;
    namespace settime
    {
        class Program
        {
            public struct SystemTime
            {
                public short wYear;
                public short wMonth;
                public short wDayOfWeek;
                public short wDay;
                public short wHour;
                public short wMinute;
                public short wSecond;
                public short wMilliseconds;
            }

            [DllImport("kernel32.dll", SetLastError = true)]
            public static extern int SetLocalTime(ref SystemTime lpSystemTime);

            static void Main(string[] args)
            {
                DateTime newDate = DateTime.Now.AddDays(1);
                SystemTime sysNew = new SystemTime();
                sysNew.wDay = (short)newDate.Day;
                sysNew.wMonth = (short)newDate.Month;
                sysNew.wYear = (short)newDate.Year;
                sysNew.wHour = 8;
                sysNew.wMinute = 59;
                sysNew.wSecond = 55;
                SetLocalTime(ref sysNew);
            }
        }
    }
  • 相关阅读:
    用sed删除空行
    烂泥:php5.6源码安装及php-fpm配置
    linux系统vsftpd登陆慢卡怎么办
    Linux Vsftpd 连接超时解决方法
    linux中shell截取字符串方法总结
    运算符
    数据类型
    is null 和=null的区别
    DML
    DDL
  • 原文地址:https://www.cnblogs.com/barrysgy/p/2734015.html
Copyright © 2011-2022 走看看