Thanx,
Khan.
public
static class HisHijriDateValidator{
/// <summary> /// HijriCalendar. /// </summary> private static HijriCalendar hjCalendar = new HijriCalendar(); /// <summary> /// Returns the Validity of the Hijri Date. /// </summary> /// <param name="hijriDate">(ShortDate DD/MM/YYYY) HijriDate in String Format </param> /// <returns>bool </returns> public static bool ValidateHijriDate( string hijriDate){
return ValidateHijriDate(hijriDate, (hjCalendar.GetYear(AppCons.Now()) - 150));}
/// <summary> /// Returns the Validity of the Hijri Date. /// </summary> /// <param name="hijriDate">(ShortDate DD/MM/YYYY) HijriDate in String Format </param> /// <param name="minimumYear">Minimum Year </param> /// <returns>bool </returns> public static bool ValidateHijriDate( string hijriDate, int minimumYear){
bool isValid = false; int[] arrayHijriDate = GetHijriDateFromString(hijriDate); int hijriDay = arrayHijriDate[0]; int hijriMonth = arrayHijriDate[1]; int hijriYear = arrayHijriDate[2]; int hjMonths = 0; int hjDays = 0; if (hijriYear >= minimumYear){
hjMonths = hjCalendar.GetMonthsInYear(hijriYear);
if (hijriMonth <= hjMonths && hijriMonth != 0){
hjDays = hjCalendar.GetDaysInMonth(hijriYear, hijriMonth);
if (!(hijriDay > hjDays || hijriDay == 0 || hijriDay < 0)){
isValid =
true;}
}
}
return isValid;}
/// <summary> /// Returns an Integer array of the Hijri Date /// </summary> /// <param name="hijriDate">Hijri Date as a string </param> /// <returns>Array of Integers, Size of the Array being 3, /// and the Date as DDMMYYY respectively to the Ascending order of the Array Index </returns> private static int[] GetHijriDateFromString( string hijriDate){
char[] delimeter = { '/', '.' , '-' }; string[] splitHijriDate; int[] intHijriDate = new int[3]; if (hijriDate != null && hijriDate.Length != 0){
splitHijriDate = hijriDate.Split(delimeter);
for (int iNdx = 0; iNdx < splitHijriDate.Length; iNdx++){
if (!(splitHijriDate[iNdx] == "0" || splitHijriDate[iNdx] == "00" || splitHijriDate[iNdx] == "000" || splitHijriDate[iNdx] == "0000" || splitHijriDate[iNdx] == "")){
intHijriDate[iNdx] =
Convert.ToInt32(splitHijriDate[iNdx]);}
}
}
return intHijriDate;}
}
Thanx.
On 10 Feb, 03:40, "Muhammed Shameem Siddique"
<mscyberguest...@gmail.com> wrote:
> By the Way .....Its the Code of the HijriCalendar i have given u, Not a
> Control...
>
> On 2/9/07, Khan <a...@programmer.net> wrote:
>
>
>
> > Hi,
> > How can i display vb.net calendar control in hijri / arabic
> > dates. I tried to change all regional settings etc. it is displaying
> > in arabic but those are gregorian dates, i want to display hijri dates
> > either in english or arabic.
>
> > Thanx,
>
> > Khan.
>
> --
> Regards,
> Shameem