Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can I change system Date/time !!

Posted on 1998-10-08
4
Medium Priority
?
154 Views
Last Modified: 2010-04-06
It is very easy question.
What is the Delphi procedures which set date and time ?

Motaz
0
Comment
Question by:Motaz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 5

Accepted Solution

by:
scrapdog earned 0 total points
ID: 1342226
You axed it twice, I'll answer it twice!!


Here is the data structure:

TSystemTime = record
    wYear: Word;
    wMonth: Word;
    wDayOfWeek: Word;
    wDay: Word;
    wHour: Word;
    wMinute: Word;
    wSecond: Word;
    wMilliseconds: Word;
  end;


Set the date time like this:

var
  NewTime :TSystemTime;

NewTime.wYear := 1998;   ,etc, etc.

Then you call the function SetSystemTime

SetSystemTime(NewTime);


If you only wanted to change one part of the system time, you could call GetSystemTime

GetSystemTime(NewTime);
NewTime.wYear := 1999;
SetSystemTime(NewTime);


The SetSystemTime function returns a boolean, indicating whether it succeeded or not.  

OK := SetSystemTime(NewTime);
if not OK then ShowMessage('Time not set');




Make sure that Windows is in your uses clause if you use any of these functions.
0
 
LVL 7

Author Comment

by:Motaz
ID: 1342227
Thanks Scrap, But I don't ask this question befor ??  :)

Motaz
0
 
LVL 7

Author Comment

by:Motaz
ID: 1342228
Thanks Scrap, But I don't ask this question befor ??  :)

Motaz
0
 
LVL 7

Author Comment

by:Motaz
ID: 1342229
Oh !!. How did you do that ? ( Answering twice ???? )
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question