14-07-24, 11:10 AM
(11-07-24, 06:12 PM)الجيل كتب : دائما مبدع اخ تركي الله يعيطك العافية
هل ممكن التعديل على الدالة بحيث تأخذ وقت السرفر و ليس جهاز الزائر
في هذا الحال نحتاج الى توضيح لعمل الكود وما هو التاريخ الأول والتاريخ الثاني.
اما فيما يخص توقيت السيرفر ما هو المقصود سيرفر داخل ام الوقت عن طريق الانترنت
في حال الوقت عن طريق الانترنت كيف يكون الوقت الأول والثاني
هذا كود لجلب الوقت من الانترنت
PHP كود :
Public Async Function GetTime() As Task(Of DateTime)
Dim client As New HttpClient()
Dim response As HttpResponseMessage = Await client.GetAsync("http://worldtimeapi.org/api/ip")
If response.IsSuccessStatusCode Then
Dim content As String = Await response.Content.ReadAsStringAsync()
Dim json As JObject = JObject.Parse(content)
Dim datetimeStr As String = json("datetime").ToString()
Dim datetime As DateTime = DateTime.Parse(datetimeStr)
Return datetime
Else
Return DateTime.MinValue
End If
End Function
وهذه الجلب البيانات
PHP كود :
Private Async Sub SomeMethod()
Dim currentTime As DateTime = Await GetTime()
If currentTime <> DateTime.MinValue Then
TextBox1.Text = currentTime.ToString("yyyy-MM-ddTHH:mm:ss")
Else
TextBox1.Text = "Failed to retrieve time."
End If
End Sub
وطريقة استدعائة في النموذج
PHP كود :
SomeMethod

