convert day to persian calendar and return - CSharp System

CSharp examples for System:DateTime Day

Description

convert day to persian calendar and return

Demo Code


using System.Text;
using System.Linq;
using System.ComponentModel;
using System.Collections.Generic;
using System;/*ww  w .j  av a 2s  .  c o  m*/

public class Main{
        /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    public static T GetPersianDay<T>(this DateTime PDateTime) where T : struct
    {
        return ChangeType<T>(new System.Globalization.PersianCalendar().GetDayOfMonth(PDateTime).ToString());
    }
        /// <summary>
    /// convert day to persian calendar and return
    /// </summary>
    /// <param name="PDateTime"></param>
    /// <returns></returns>
    public static int GetPersianDay(this DateTime PDateTime)
    {
        return new System.Globalization.PersianCalendar().GetDayOfMonth(PDateTime);
    }
}

Related Tutorials