@{
Dim lastUpdatedOnDay As Int = CurrentNode.Data.DateModified.Day
Dim lastUpdatedOn As String = lastUpdatedOnDay + GetDaySuffix(lastUpdatedOnDay) + CurrentNode.Data.DateModified.ToString(" MMMM yyyy")
}
<span>Last updated on @lastUpdatedOn</span>
@Functions
Function GetDaySuffix(day As Integer) As String
Select Case day
Case 1, 21, 31
Return "st"
Case 2, 22
Return "nd"
Case 3, 23
Return "rd"
Case Else
Return "th"
End Select
End Function
End Functions
@{
int lastUpdatedOnDay = CurrentNode.Data.DateModified.Day;
string lastUpdatedOn = lastUpdatedOnDay + GetDaySuffix(lastUpdatedOnDay) + CurrentNode.Data.DateModified.ToString(" MMMM yyyy");
}
<span>Last updated on @lastUpdatedOn</span>
@functions {
//Gets suffix for current day (st, nd, rd or th)
string GetDaySuffix(int day)
{
if (day == 1 || day == 21 || day == 31)
{
return "st";
}
else if (day == 2 || day == 22)
{
return "nd";
}
else if (day == 3 || day == 23)
{
return "rd";
}
else
{
return "th";
}
}
}