+ Reply to Thread
Results 1 to 2 of 2

Thread: change date and time of the computer

  1. #1
    YAR
    YAR is offline
    Newbie YAR is an unknown quantity at this point
    Join Date
    Dec 2008
    Posts
    5

    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. #2
    Code Warrior Termana is a name known to all Termana is a name known to all Termana is a name known to all Termana is a name known to all Termana is a name known to all Termana is a name known to all Termana's Avatar
    Join Date
    Oct 2008
    Posts
    4,055
    Blog Entries
    6

    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.
    My Site | Questions and Answers | Ask Me: Termana | Last Tutorial: Ajax innerHTML
    If you can keep your head while all around you are losing theirs, you probably have a CD writer on your desktop

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. Displaying Current Time and Date
    By dcs in forum C Tutorials
    Replies: 2
    Last Post: 12-11-2008, 05:35 PM
  2. Keeping your computer clean and fast
    By Brandon W in forum Tutorials
    Replies: 118
    Last Post: 10-10-2008, 04:46 PM
  3. date and time present
    By Siten0308 in forum C# Programming
    Replies: 11
    Last Post: 10-10-2008, 12:58 PM
  4. Windows Shortcut List - Saves Time
    By 2stamlers in forum The Lounge
    Replies: 6
    Last Post: 04-10-2008, 06:58 AM
  5. PHP:Tutorial The Date
    By John in forum PHP Tutorials
    Replies: 0
    Last Post: 01-10-2007, 06:10 PM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

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