How can i change System DateTime Programetically.
How can i change my System DateTime Programetically.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Hirendra SisodiyaPosted Jun 29, 2010, 6:31 AM
hello ankur
i think you can do that with hte help of kernal32.dll api.
you need to import this like
and use SetSystemTime function forchange the system date.
thanks
Please mark as answer if it helps
DamodarPosted Jul 9, 2010, 1:16 PM
try this to change ur system time..
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 bool SetSystemTime( [In] ref SYSTEMTIME st );
If you want to change the time zone in your system here is the code sample
http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/fa563f41-344c-465d-bfbe-1859299d2491/
Ankur GuptaPosted Jun 3, 2010, 12:52 AM
Abhimanyu K VatsaPosted Jun 2, 2010, 9:44 AM
as i know c# or asp.net or php or coldfusion are web based programming languages and it is not possible to change the date and time via thease all languages. one main reason would be 'web languages are not console based language'. only console based application languages can change the date and time of system. basically from DOS or vb etc.
good luck