PDA

View Full Version : چطور تاریخ ویندوز رو عوض کنم؟



hex161
چهارشنبه 12 اردیبهشت 1386, 12:36 عصر
با سلام.
چطور میشه از طریق برنامه یا کد نویسی تاریخ و ساعت ویندوز رو عوض کرد؟
ممنون.

m-khorsandi
چهارشنبه 12 اردیبهشت 1386, 15:05 عصر
از تابع SetLocalTime استفاده کن.

hex161
پنج شنبه 13 اردیبهشت 1386, 12:39 عصر
برای تاریخ چطور؟

m-khorsandi
پنج شنبه 13 اردیبهشت 1386, 14:00 عصر
The SetLocalTime function sets the current local time and date.

ealvandi
شنبه 15 اردیبهشت 1386, 00:49 صبح
البته SetLocalTime یک API هست. و توسط اون هم زمان و هم تاریخ سیستم رو میشه عوض کرد.

SoftDevCo
شنبه 15 اردیبهشت 1386, 01:48 صبح
می تونید از این تابع استفاده کنید:


function SetSystemTime(DateTime: TDateTime): Boolean;
var
tSetDati: TDateTime;
vDatiBias: Variant;
tTZI: TTimeZoneInformation;
tST: TSystemTime;
begin
GetTimeZoneInformation(tTZI);
vDatiBias := tTZI.Bias / 1440;
tSetDati := DateTime + vDatiBias;
with tST do
begin
wYear := StrToInt(FormatDateTime('yyyy', tSetDati));
wMonth := StrToInt(FormatDateTime('mm', tSetDati));
wDay := StrToInt(FormatDateTime('dd', tSetDati));
wHour := StrToInt(FormatDateTime('hh', tSetDati));
wMinute := StrToInt(FormatDateTime('nn', tSetDati));
wSecond := StrToInt(FormatDateTime('ss', tSetDati));
wMilliseconds := 0;
end;
Result := Windows.SetSystemTime(tST);
end;