بحث مخصص من جوجل فى أوفيسنا
Custom Search
|
البحث في الموقع
Showing results for tags 'التحويل بين الميلادي والهجري'.
تم العثور علي 1 نتيجه
-
تقومان بفحص تقويم الـ vba ونوع المدخل، فهي تساعد المستخدم كثيرا وتجنبه الأخطاء إن شاء الله. عملت تجاربي عليها، ويمكنكم اجراء المزيد من التجارب. Option Compare Database Option Explicit Function Greg2Hijri(GregDate As Variant, _ Optional dFormat As String = "yyyy/mm/dd") As Variant Dim CurCal As VbCalendar On Error Resume Next CurCal = Calendar Greg2Hijri = Null '"WrongInput" If Calendar = vbCalGreg And (VarType(GregDate) = vbDate Or _ VarType(GregDate) = vbLong) Then Calendar = vbCalHijri Greg2Hijri = Format(GregDate, dFormat) ElseIf VarType(GregDate) = vbString Then Calendar = vbCalGreg If IsDate(GregDate) Then Greg2Hijri = CDate(GregDate) End If End If Calendar = CurCal End Function '------------------------- Function Hijri2Greg(HijriDate As Variant, _ Optional dFormat As String = "yyyy/mm/dd") As Variant Dim CurCal As VbCalendar On Error Resume Next CurCal = Calendar Hijri2Greg = Null '"WrongInput" If Calendar = vbCalHijri And (VarType(HijriDate) = vbDate Or _ VarType(HijriDate) = vbLong) Then Calendar = vbCalGreg Hijri2Greg = Format(HijriDate, dFormat) ElseIf VarType(HijriDate) = vbString Then Calendar = vbCalHijri If IsDate(HijriDate) Then Hijri2Greg = CDate(HijriDate) End If End If Calendar = CurCal End Function '-------------------------------------------------------------------- Sub TestingDateConverting() Dim CurCal As VbCalendar CurCal = Calendar Debug.Print "Greg2Hijri" Calendar = vbCalGreg Debug.Print Greg2Hijri(Date, "yyyy-mmmm-dd") Debug.Print Greg2Hijri(CLng(Date), "yyyy mm dd") Debug.Print Greg2Hijri("06/07/2023") Debug.Print "-----------" Calendar = vbCalHijri Debug.Print Greg2Hijri(Date, "yyyy-mmmm-dd") Debug.Print Greg2Hijri(CLng(Date), "yyyy mm dd") Debug.Print Greg2Hijri("06/07/2023") Debug.Print "-------------------------------" Debug.Print "Hijri2Greg" Calendar = vbCalHijri Debug.Print Hijri2Greg(Date, "yyyy-mmmm-dd") Debug.Print Hijri2Greg(CLng(Date), "yyyy mm dd") Debug.Print Hijri2Greg("18/12/1444") Debug.Print "-----------" Calendar = vbCalGreg Debug.Print Hijri2Greg(Date, "yyyy-mmmm-dd") Debug.Print Hijri2Greg(CLng(Date), "yyyy mm dd") Debug.Print Hijri2Greg("18/12/1444") Debug.Print "-------------------------------" Calendar = CurCal End Sub