Show date with time in PersianCalendar format in C#

Last Reply on Oct 24, 2016 06:02 AM By AnandM

Posted on Oct 24, 2016 01:49 AM


I used below code to change date to shamsi type (persian date)

    public string miladitoshamsi(object miladi1)
        DateTime miladi = Convert.ToDateTime(miladi1);
        System.Globalization.PersianCalendar shamsi = new System.Globalization.PersianCalendar();
        return string.Format("{0}/{1}/{2}", shamsi.GetYear(miladi), shamsi.GetMonth(miladi), shamsi.GetDayOfMonth(miladi));


but it just show date I want it shows date with time from database:

in database I save date and time in table

Date  datetime

You are viewing reply posted by: AnandM on Oct 24, 2016 06:02 AM.
Posted on Oct 24, 2016 06:02 AM

Hi nedash,

I have modified my code please have go through it