منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
[سؤال] كيف تغير التاريخ - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : [سؤال] كيف تغير التاريخ (/showthread.php?tid=1172)



كيف تغير التاريخ - أسامة - 04-12-13

كيف تغير التاريخ فى الكمبيوتر


RE: كيف تغير التاريخ - tariq2812 - 05-12-13

كود :
#Region "Set the date and time"
    Public Structure SYSTEMTIME
        Dim wYear As UInt16
        Dim wMonth As UInt16
        Dim wDayOfWeek As UInt16
        Dim wDay As UInt16
        Dim wHour As UInt16
        Dim wMinute As UInt16
        Dim wSecond As UInt16
        Dim wMilliseconds As UInt16
    End Structure
    Declare Function GetSystemTime Lib "Kernel32.dll" _
     (ByRef lpSystemTime As SYSTEMTIME) As UInt32

    Declare Function SetSystemTime Lib "Kernel32.dll" _
     (ByRef lpSystemTime As SYSTEMTIME) As UInt32

    Public Sub SetTime(ByVal d As Date)
        'التعديل على توقيت جرينتش

        Dim st As New SYSTEMTIME
        GetSystemTime(st)


        st.wDay = d.Day ' اليوم
        st.wMonth = d.Month ' الشهر
        st.wYear = d.Year ' السنة
        st.wHour = d.Hour ' الساعة24
        st.wMinute = d.Minute ' الدقائق
        'st.wSecond = d.Second ' الثواني
        SetSystemTime(st)

    End Sub
#End Region

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        SetTime(Date.UtcNow.AddHours(+1))
    End Sub