// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Runtime.InteropServices; public struct SYSTEMTIME { public UInt16 Year ; public UInt16 Month ; public UInt16 DayOfWeek ; public UInt16 Day ; public UInt16 Hour ; public UInt16 Minute ; public UInt16 Second ; public UInt16 MilliSecond ; } class MainClass { [DllImport("kernel32.dll")] private static extern bool SetSystemTime(ref SYSTEMTIME st); public static void Main(string[] args) { SYSTEMTIME st = new SYSTEMTIME(); st.Year = 2003; st.Month = 9; st.Day = 29; st.Hour = 21; st.Minute = 0; st.Second = 0; SetSystemTime(ref st); } }