Closed Thread
Results 1 to 2 of 2

Thread: change date and time of the computer

  1. #1
    YAR
    YAR is offline Newbie
    Join Date
    Dec 2008
    Posts
    5
    Rep Power
    0

    change date and time of the computer

    hi
    how can I change the date and time of the computer

    It is possible to protect the network setting from changed by any one
    use computer

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Oct 2008
    Posts
    4,060
    Blog Entries
    6
    Rep Power
    45

    Re: change date and time of the computer

    Putting this code in the appropriate places, and making sure you have
    Code:
    using System.Runtime.InteropServices;
    at the top will allow you to change the date and time. If you don't know where to put this code, I can help on that - just ask.
    Code:
    DllImport("kernel32.dll", SetLastError=true) // Add a [ to the start of this (where the Dll is and put a ] where the ending bracket is.
    Public static extern int SetLocalTime (ref SystemTime lpSystemTime); 
    //struct for date/time apis 
    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; 
    } 
    
    
    
    SystemTime systNew = new SystemTime(); 
    //set the properties 
    systNew.wDay = 24; 
    systNew.wMonth = 1; 
    systNew.wYear = 2009; 
    systNew.wHour = 7; 
    systNew.wMinute = 0; 
    systNew.wSecond = 0; 
    //and update using the api 
    SetLocalTime(ref systNew);
    I don't understand your second question though sorry.
    Interested in participating in community events?
    Want to harness your programming skill and turn it into absolute prowess?
    Come join our programming events!

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. how to change date to yyyy-mm-dd and reverse?
    By Hamed in forum PHP Development
    Replies: 1
    Last Post: 12-24-2010, 11:44 AM
  2. Change date and time format
    By WhyLinux in forum Linux/Unix General
    Replies: 3
    Last Post: 06-18-2009, 08:16 AM
  3. PHP date? Time?
    By phpforfun in forum PHP Development
    Replies: 6
    Last Post: 03-19-2009, 04:13 PM
  4. Date and Time
    By zeroradius in forum Database & Database Programming
    Replies: 2
    Last Post: 02-01-2009, 12:21 PM
  5. Change the date and timezone?
    By Crop in forum Linux/Unix General
    Replies: 2
    Last Post: 11-28-2008, 06:55 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts