mikaelmax99
Ad Placement Specialist
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 2
1000 XP
In this article, i will teach you how to create a program that will change the system date of your computer. This tutorial is very helpful to your program or system having this integration.
So, now let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio 2010: Go to File, click New Project, and choose Windows Application.
2. Next, add one DateTimePicker and and one button. You must design your interface like this:
3. Import first the Runtime.InteropServices to access the DLL of the kernel32 in accessing the system date.
Now, use a structure that will have the variables for the reference of our DLL.
then put this code in your button to change directly the system date.
Done!
Output:
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
If you have some queries, feel free to contact the number or e-mail below.
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware
So, now let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio 2010: Go to File, click New Project, and choose Windows Application.
2. Next, add one DateTimePicker and and one button. You must design your interface like this:

3. Import first the Runtime.InteropServices to access the DLL of the kernel32 in accessing the system date.
- using
System.Runtime.InteropServices
;
Now, use a structure that will have the variables for the reference of our DLL.
- public
struct
SystemDate
- {
- public
ushort
Year;
- public
ushort
Month;
- public
ushort
DayOfWeek;
- public
ushort
Day;
- public
ushort
Hour;
- public
ushort
Minute;
- public
ushort
Second;
- public
ushort
Millisecond;
- }
;
- import the DLL now,
- <
csharp>
- [
DllImport(
"kernel32.dll"
, EntryPoint =
"SetSystemTime"
, SetLastError =
true
)
]
- public
extern
static
bool
Win32SetSystemTime(
ref
SystemDate sysDate)
;
- }
;
then put this code in your button to change directly the system date.
- private
void
button1_Click(
object
sender, EventArgs e)
- {
- SystemDate updatedTime =
new
SystemDate(
)
;
- updatedTime.
Month
=
(
ushort
)
dateTimePicker1.
Value
.
Month
;
- updatedTime.
Day
=
(
ushort
)
dateTimePicker1.
Value
.
Day
;
- updatedTime.
Year
=
(
ushort
)
dateTimePicker1.
Value
.
Year
;
- //this will update the date in your system date
- Win32SetSystemTime(
ref
updatedTime)
;
- MessageBox.
Show
(
"The system date has changed!"
, "Message"
, MessageBoxButtons.
OK
, MessageBoxIcon.
Information
)
;
- }
Done!
Output:

For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
If you have some queries, feel free to contact the number or e-mail below.
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware