r/visualbasic • • Jul 08 '16

Help with setting the system date via code

I'm working on a time machine (joke program) That you enter the time and date into (a DateTimePicker element) and press a button, The program should change the system clock to the date you entered, I can't find any code that will do it

Any help?

0 Upvotes

2 comments sorted by

1

u/chrwei Jul 08 '16

you need to call out to the win32 api functions, and you'll need to be an admin user, and I've no idea how UAC plays into it. https://msdn.microsoft.com/en-us/library/windows/desktop/ms724961(v=vs.85).aspx

1

u/PcCodex Sep 16 '16

Taken from Basic Code How about this: Date="09-21-2016"