Try Now
More in this section

Forums / Developing with Sitefinity / Arabic site News Listing to show date in Gregorian

Arabic site News Listing to show date in Gregorian

2 posts, 0 answered
  1. Paul
    Paul avatar
    14 posts
    10 Mar 2012
    31 Jul
    Link to this post
    News listing plugin on Arabic site is showing publication date in Hijri format. I want it to be in Gregorian. Can anyone help?
  2. Victor Leontyev
    Victor Leontyev avatar
    65 posts
    01 Jul 2014
    13 Aug in reply to Paul
    Link to this post

    Hi Paul. I had the same problem. I just built new extension for ItemViewModel.

    public static class ItemViewModelExtension
            public static string GetDateTimeGregorianCalendar(this ItemViewModel item, string fieldName, string format)
                var date = (DateTime)item.Fields.GetMemberValue(fieldName);
                var culture = new CultureInfo(Thread.CurrentThread.CurrentUICulture.Name);
                GregorianCalendar calendar = new GregorianCalendar();
                culture.DateTimeFormat.Calendar = calendar;
                return date.ToString(format, culture);

    And in Feather widget template i am using 

    @item.GetDateTimeGregorianCalendar("PublicationDate", "MMM d, yyyy, HH:mm tt")


    @item.GetDateTime("PublicationDate", "MMM d, yyyy, HH:mm tt")


2 posts, 0 answered