Converts the Umm Al Qura date to Gregorian date. - CSharp System

CSharp examples for System:DateTime Convert

Description

Converts the Umm Al Qura date to Gregorian date.

Demo Code


using System.Text;
using System.Linq;
using System.Globalization;
using System.Collections.Generic;
using System;/*from w w  w  .java2s  .co  m*/

public class Main{
        /// <summary>
        /// Converts the UmAlQura date to Gregorian date.
        /// </summary>
        /// <param name="umAlQuraDate">The UmAlQura date.</param>
        /// <returns>Gregorian date</returns>
        public static DateTime ConvertUmAlQuraToGreg(this string umAlQuraDate)
        {
            System.Globalization.UmAlQuraCalendar calendar = new System.Globalization.UmAlQuraCalendar();
            return calendar.ToDateTime(int.Parse(umAlQuraDate.Substring(0, 4)), int.Parse(umAlQuraDate.Substring(4, 2)), int.Parse(umAlQuraDate.Substring(6, 2)), 0, 0, 0, 0);
        }
}

Related Tutorials