كيف استخرج التاريخ من الانترنيت و اضعه في ايديت ؟
#2
وعليكم السلام

التحقق من الاتصال بالانترنت


كود :
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;
قل: اللهم فاطِرَ السماوات والأرض عالم الغيبِ والشهادة، ربَّ كُلِّ شَيءٍ ومَلِيكَه، أَشْهد أن لا إله إلا أنت، أعوذ بك من شرِّ نفسي وشرِّ الشيطان وشِرْكِهِ وأن أقترف على نفسي سوءًا أو أجرُّه إلى مسلم
[-] كل من 6 users say قال شكرا ل Delphi4Us على المشاركة المفيدة
  • أبو معاذ, صالح حمادي, bassem_43, h-farid, salmaanga, wadoud
الرد


الردود في هذا الموضوع
RE: كيف استخرج التاريخ من الانترنيت و اضعه في ايديت ؟ - بواسطة Delphi4Us - 26-10-2020, 07:22 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم