Showing posts with label time. Show all posts
Showing posts with label time. Show all posts

procedure TForm1.FormCreate(Sender:TObject);
begin
Application.HintColor := clAqua; // or another color
Application.HintPause := 250; // 250 mSec before hint is shown
Application.HintHidePause :=3000; // hint disappears after 3 secs
end;

Question: I want code to find last day of the month. I want to make calendar.

Question:
Delphi give use native function for this.
Check this.

uses SysUtils, DateUtils;


function getLastDay : TDateTime;
begin
result := EncodeDate(YearOf(Now), MonthOf(Now), MonthDays[IsLeapYear(YearOf(Now)), MonthOf(Now)]);

end;


Question:
I want to change System time from my application immediatelly.
Do you have the code?

Answer:
Sure,
The input strings for date and time depends on the format you are using.


procedure TForm1.Button1Click(Sender: TObject);
var
SystemTime: TSystemTime;
NewTime, NewDate: string;
begin
NewTime := '12:00:00';
NewDate := '01.01.2006';
DateTimeToSystemTime(StrToDate(NewDate) + StrToTime(NewTime), SystemTime);
SetLocalTime(SystemTime);
// Tell windows, that the Time changed!
PostMessage(HWND_BROADCAST, WM_TIMECHANGE, 0, 0); // *
end;


Question:
How to call windows system time dialog?

Answer:
Using shellAPI fuction.


uses
Shellapi;

procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(Handle, 'open', 'control', 'date/time', nil, SW_SHOW);
end;


CLICK TO REGISTER