الجديد اليوم أكواد مكتبة الأكواد
السلام عليكم
هذه أكواد مكتبة الأكواد 2009 للى ما اشتغلش البرنامج عندهم
القسم : التعامل مع الوقت
إظهار الوقت الحالي
رموز PHP:
MsgBox(TimeOfDay)
معرفة عدد أيام الشهر
رموز PHP:
Dim shtDayCount As Short
shtDayCount = System.DateTime.DaysInMonth("2009", "3")
MessageBox.Show("There are " & shtDayCount.ToString & _
" days in that month")
الدالة DateSerial لأعطاء التاريخ
رموز PHP:
'هذه الدالة تعطيك التاريخ
MsgBox(DateSerial((Now.Year), (Now.Month), (Now.Day)))
'أيضا لو أردت التاريخ بعد فترة معينة ولكتكن 1000 يوم
MsgBox(DateSerial((Now.Year), (Now.Month), (Now.Day) + 1000))
إظهار تحية عند فتح البرنامج حسب الوقت
رموز PHP:
ضع هذا الكود في حدث تحميل الفورم
If TimeOfDay <= "11:30 AM" Then
MsgBox("Good Morning YourNameHere!")
Exit Sub
End If
If TimeOfDay > "11:30 AM" And TimeOfDay < "5:00 PM" Then
MsgBox("Good Afternoon YourNameHere!")
Exit Sub
End If
If TimeOfDay > "5:00 PM" Then
MsgBox("Good Evening YourNameHere!")
Exit Sub
End If
If TimeOfDay >= "12:01 AM" Then
MsgBox("Good Morning YourNameHere!")
Exit Sub
End If
كيفية تحويل التاريخ من هجري إلى ميلادي
رموز PHP:
Function ToHijra(ByVal gDate As Date, Optional ByVal format As String = Nothing) As String
Return gDate.ToString(format, New Globalization.CultureInfo("ar-SA"))
End Function
مثال على أستخدام الكود
Textbox1.Text = ToHijra(Now, "d dddd, MMMM yyyy")
لحصول على الوقت والتاريخ
رموز PHP:
Dim localTime As Date = My.Computer.Clock.LocalTime
MsgBox(localTime)
لتحويل قيمة رقمية إلى ساعات:دقائق:ثواني
رموز PHP:
Function ReturnDegreesMinutesSecondsFromDecimalDegrees(ByVal DecimalDegrees As Decimal) As String
Dim DecDegAbs As Decimal = Math.Abs(DecimalDegrees)
Dim ReturnValue As String = "'"
Dim DegreeSymbol As String = "°"
Dim MinutesSymbol As String = "’"
Dim SecondsSymbol As String = """"
Dim Degrees As String = Math.Truncate(DecDegAbs) & DegreeSymbol
Dim MinutesDecimal As Decimal = (DecDegAbs - Math.Truncate(DecDegAbs)) * 60
Dim SecondsDecimal As Decimal = (MinutesDecimal - Math.Truncate(MinutesDecimal))
Dim Minutes As String = Math.Truncate(MinutesDecimal) & MinutesSymbol
Dim Seconds As String = String.Format("{0:##.0000}", (SecondsDecimal * 60)) & SecondsSymbol
ReturnValue = Degrees & " " & Minutes & " " & Seconds
Return ReturnValue
End Function
لمعرفة ان كانت السنة كبيسة أم لا
رموز PHP:
If DateTime.IsLeapYear(السنة) = True Then
MsgBox("السنة كبيسة")
Else
MsgBox("السنة غير كبيسة")
End If
للحصول على أكبر وأضغر تاريخ مضبوط بالنظام
رموز PHP:
'أكبرتاريخ
MsgBox(DateTime.MaxValue.ToString)
'أصغر تاريخ
MsgBox(DateTime.MinValue.ToString)
لاضافة ال Formats المختلفة
رموز PHP:
Dim dateTime As DateTime = New DateTime(Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, Now.Second)
Dim d() As String = Nothing
d = dateTime.GetDateTimeFormats()
ListBox1.Items.AddRange(d)
معرفة أذا كان النص المدخل تاريخ
رموز PHP:
Public Function IsDate(ByVal DateIn As String) As Boolean
Dim datDateTime As DateTime
Dim blnIsDate As Boolean = True
Try
' Attempt to parse date
datDateTime = DateTime.Parse(DateIn)
Catch e As FormatException
' Error parsing, return False
blnIsDate = False
End Try
Return blnIsDate
End Function
إضافة أيام إلى تاريخ معين
رموز PHP:
Dim MyDate As DateTime
MyDate = Now
MyDate.AddDays(7) Change
MessageBox.Show(MyDate)
وضع التاريخ مع الوقت
رموز PHP:
Me.Label.Text = My.Computer.Clock.LocalTime.ToString("MM/dd/yyyy hh:mm")