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...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
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...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.