Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi All,
I want to eliminate replicated copies of month and year from the date i get.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
var blogs = Umbraco.TypedContentAtRoot().DescendantsOrSelf("ArticulateRichText").OrderBy("publishedDate desc");
List<DateTime> dateList = new List<DateTime>();
foreach (dynamic blog in blogs)
{
DateTime date = blog.GetPropertyValue<DateTime>("publishedDate");
//var year = @String.Format("{0:yyyy/MM}", date);
//var month = year.ToString("MMMM yyyy");
dateList.Add(@date);
}
List<DateTime> unique = dateList.Distinct().ToList();
<ul>
@foreach (dynamic m in unique)
<li><a>@m.ToString("MMMM yyyy")</a></li>
</ul>
How can i do it?
Thanks
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
to eliminate replicated copies
Hi All,
I want to eliminate replicated copies of month and year from the date i get.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
var blogs = Umbraco.TypedContentAtRoot().DescendantsOrSelf("ArticulateRichText").OrderBy("publishedDate desc");
List<DateTime> dateList = new List<DateTime>();
foreach (dynamic blog in blogs)
{
DateTime date = blog.GetPropertyValue<DateTime>("publishedDate");
//var year = @String.Format("{0:yyyy/MM}", date);
//var month = year.ToString("MMMM yyyy");
dateList.Add(@date);
}
List<DateTime> unique = dateList.Distinct().ToList();
<ul>
@foreach (dynamic m in unique)
{
<li><a>@m.ToString("MMMM yyyy")</a></li>
}
</ul>
}
How can i do it?
Thanks
is working on a reply...