تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
اريد ملف يستعلم عن الوقت
#1
السلام عليكم
الاستافضة الخاصة بى لا تدعم ASB
اريد عمل ملف PHP
اقوم عن طريقه بمعرفة الساعة الان
لاقوم بضبط ساعة الكمبيوتر عليها
وجزاكم الله خيرا
الرد }}}
تم الشكر بواسطة:
#2
كود :
<?php
$var_time=date("Y-m-d",time());

?>


d - The day of the month (from 01 to 31)
D - A textual representation of a day (three letters)
j - The day of the month without leading zeros (1 to 31)
l (lowercase 'L') - A full textual representation of a day
N - The ISO-8601 numeric representation of a day (1 for Monday, 7 for Sunday)
S - The English ordinal suffix for the day of the month (2 characters st, nd, rd or th. Works well with j)
w - A numeric representation of the day (0 for Sunday, 6 for Saturday)
z - The day of the year (from 0 through 365)
W - The ISO-8601 week number of year (weeks starting on Monday)
F - A full textual representation of a month (January through December)
m - A numeric representation of a month (from 01 to 12)
M - A short textual representation of a month (three letters)
n - A numeric representation of a month, without leading zeros (1 to 12)
t - The number of days in the given month
L - Whether it's a leap year (1 if it is a leap year, 0 otherwise)
o - The ISO-8601 year number
Y - A four digit representation of a year
y - A two digit representation of a year
a - Lowercase am or pm
A - Uppercase AM or PM
B - Swatch Internet time (000 to 999)
g - 12-hour format of an hour (1 to 12)
G - 24-hour format of an hour (0 to 23)
h - 12-hour format of an hour (01 to 12)
H - 24-hour format of an hour (00 to 23)
i - Minutes with leading zeros (00 to 59)
s - Seconds, with leading zeros (00 to 59)
u - Microseconds (added in PHP 5.2.2)
e - The timezone identifier (Examples: UTC, GMT, Atlantic/Azores)
I (capital i) - Whether the date is in daylights savings time (1 if Daylight Savings Time, 0 otherwise)
O - Difference to Greenwich time (GMT) in hours (Example: +0100)
P - Difference to Greenwich time (GMT) in hours:minutes (added in PHP 5.1.3)
T - Timezone abbreviations (Examples: EST, MDT)
Z - Timezone offset in seconds. The offset for timezones west of UTC is negative (-43200 to 50400)
c - The ISO-8601 date (e.g. 2013-05-05T16:34:42+00:00)
r - The RFC 2822 formatted date (e.g. Fri, 12 Apr 2013 12:01:05 +0200)
U - The seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
http://www.w3schools.com/php/php_ref_date.asp
الرد }}}
تم الشكر بواسطة: RaggiTech
#3
السلام عليكم ورحمة الله وبركاته

أنظر هذا المثال
كود :
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox(GetFastestNISTDate().ToLocalTime)
    End Sub

    Public Function GetFastestNISTDate() As DateTime
        Dim result = DateTime.MinValue
        ' Initialize the list of NIST time servers
        ' http://tf.nist.gov/tf-cgi/servers.cgi
        Dim servers As String() = New String() _
        {"nist1-ny.ustiming.org", "nist1-nj.ustiming.org", "nist1-pa.ustiming.org", "time-a.nist.gov", "time-b.nist.gov", "nist1.aol-va.symmetricom.com", _
         "nist1.columbiacountyga.gov", "nist1-chi.ustiming.org", "nist.expertsmi.com", "nist.netservicesgroup.com"}

        ' Try 5 servers in random order to spread the load
        Dim rnd As New Random()
        For Each server As String In servers.OrderBy(Function(s) rnd.NextDouble()).Take(5)
            Try
                ' Connect to the server (at port 13) and get the response
                Dim serverResponse As String = String.Empty
                Using reader = New IO.StreamReader(New System.Net.Sockets.TcpClient(server, 13).GetStream())
                    serverResponse = reader.ReadToEnd()
                End Using

                ' If a response was received
                If Not String.IsNullOrEmpty(serverResponse) Then
                    ' Split the response string ("55596 11-02-14 13:54:11 00 0 0 478.1 UTC(NIST) *")
                    Dim tokens As String() = serverResponse.Split(" "c)

                    ' Check the number of tokens
                    If tokens.Length >= 6 Then
                        ' Check the health status
                        Dim health As String = tokens(5)
                        If health = "0" Then
                            ' Get date and time parts from the server response
                            Dim dateParts As String() = tokens(1).Split("-"c)
                            Dim timeParts As String() = tokens(2).Split(":"c)

                            ' Create a DateTime instance
                            Dim utcDateTime As New DateTime(Convert.ToInt32(dateParts(0)) + 2000, Convert.ToInt32(dateParts(1)), Convert.ToInt32(dateParts(2)), Convert.ToInt32(timeParts(0)), Convert.ToInt32(timeParts(1)), Convert.ToInt32(timeParts(2)))

                            ' Convert received (UTC) DateTime value to the local timezone
                            result = utcDateTime '.ToLocalTime()

                            ' Response successfully received; exit the loop

                            Return result
                        End If

                    End If

                End If
                ' Ignore exception and try the next server
            Catch
            End Try
        Next
        Return result
    End Function

End Class



السلام عليكم ورحمة الله وبركاته
الرد }}}
تم الشكر بواسطة:
#4
حبيبي أبو رائد كود شكله خطير
ياريت بعد أذنك تعطيني فكرة عامة عنه
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [سؤال] فنكشن vb . net اريد تحويله الي فنكشن php او اي طريقة تؤدي نفس الوظيف الماجيك مسعد 2 1,382 31-03-20, 07:27 PM
آخر رد: الماجيك مسعد
  [سؤال] اريد نموذج تسجيل ramygamalvb 1 1,734 21-01-20, 11:06 PM
آخر رد: abubasilIraq
  عندي معلومات في ملف نصي اريد استخرج القيمة على حسب اعلى رقم abumuhannadzym 3 1,380 19-12-19, 11:13 PM
آخر رد: abumuhannadzym

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


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