GetDateDayWithSuffix

edit

GetDateDayWithSuffix

Namespace

Summary== Given a datetime object, returns the formatted day, "15th" ==Example==var output="The post was published on the "+Post.PublishedDate.GetDateDayWithSuffix(); ==Unit Test

public void GetDateDayWithSuffixShouldBeApril16thForParsedDate() { var today = DateTime.Parse("4/16/2009"); var result = today.GetDateDayWithSuffix(); Assert.Equal("16th", result); }

Comments

SubSonic 3.0 implements this as an extension on System.DateTime - 2.x uses a static method on SubSonic.Sugar.Dates.