C# – How to set system time in Windows 10 IoT

c++raspberry-piwindows-10-iot-core

Is there a way to set system time from my app running on a Raspberry Pi 2 in Windows 10 IoT Core Insider Preview?

This doesn't work for lack of kernel32.dll

    [DllImport("kernel32.dll", EntryPoint = "SetSystemTime", SetLastError = true)]
    extern static bool Win32SetSystemTime(ref SystemTime sysTime);

Best Solution

First, connect to your Pi 2 using PowerShell.

Use the command set-date to set the time. For example, if you want to set the date to Saturday, October 3, 2015, 2:00PM, you would type set-date 10/3/2015 2:00PM.

The command tzutil sets the time zone. Type tzutil /? for usage

Related Question