![]() |
|
كيف استخرج التاريخ من الانترنيت و اضعه في ايديت ؟ - نسخة قابلة للطباعة +- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum) +-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3) +--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15) +--- الموضوع : كيف استخرج التاريخ من الانترنيت و اضعه في ايديت ؟ (/showthread.php?tid=11087) |
كيف استخرج التاريخ من الانترنيت و اضعه في ايديت ؟ - salmaanga - 21-10-2020 السلام عليكم اخواني اولا : كيف اتحقق من وجود اتصال من عدمه مع اخبار المستخدم بذالك ؟ ثانيا : عند وجود اتصال كيف استخرج التاريخ من الانترنيت و وضعه في ايديت ؟ ثالثا : كيف اجعل البرنامج يصحح تاريخ الجهاز تلقائيا مع وجود اتصال ؟ و شكرا RE: كيف استخرج التاريخ من الانترنيت و اضعه في ايديت ؟ - Delphi4Us - 26-10-2020 وعليكم السلام التحقق من الاتصال بالانترنت كود : function YourFunctionName : boolean;
var
origin : cardinal;
begin
result := InternetGetConnectedState(@origin,0);
//connections origins by origin value
//NO INTERNET CONNECTION = 0;
//INTERNET_CONNECTION_MODEM = 1;
//INTERNET_CONNECTION_LAN = 2;
//INTERNET_CONNECTION_PROXY = 4;
//INTERNET_CONNECTION_MODEM_BUSY = 8;
end;او جرب كود : function TMainF.isInternetConnection: Boolean;
begin
try
IdHTTP.Get('http://www.svtech.cz');
except
on E: Exception do begin
if not (E is EIdHTTPProtocolException) then begin
Result := False;
Exit;
end;
end;
end;
Result := True;
end;الحصول على التاريخ والوقت كود : var
SNTPClient: TIdSNTP;
begin
SNTPClient := TIdSNTP.Create(nil);
try
SNTPClient.Host := 'pool.ntp.org';
SNTPClient.SyncTime;
finally
SNTPClient.Free;
end;
end;كود : Label1.Caption := DateToStr(IdSNTP1.DateTime)
+ ' - ' + TimeToStr(IdSNTP1.DateTime);
Label2.Caption := IdSNTP1.Host;تغيير التاريخ كود : var
myDateTime, newDate : TDateTime;
begin
// Set the date to 29/10/2002 at 12:34:56
myDateTime := EncodeDateTime(2002, 10, 29, 12, 34, 56, 0);
ShowMessage('The starting date/time = '+DateTimeToStr(myDateTime));
// Now change the date portion without touching the time
newDate := EncodeDate(1957, 02, 18);
ReplaceDate(myDateTime, newDate);
ShowMessage('The new date/time = '+DateTimeToStr(myDateTime));
end;تغيير الوقت كود : var
myDateTime, newTime : TDateTime;
begin
// Set the date to 29/10/2002 at 12:34:56
myDateTime := EncodeDateTime(2002, 10, 29, 12, 34, 56, 0);
ShowMessage('The starting date/time = '+DateTimeToStr(myDateTime));
// Now change the time portion without touching the date
newTime := EncodeTime(9, 45, 52, 0);
ReplaceTime(myDateTime, newTime);
ShowMessage('The new date/time = '+DateTimeToStr(myDateTime));
end;RE: كيف استخرج التاريخ من الانترنيت و اضعه في ايديت ؟ - onexite - 01-11-2020 PHP كود : Uses IdSNTP ; |