Date Format Fun

@* Simple short date format
@item.GetDateTime("PubDate").ToString("d")
*@

Go to this URL for more
https://www.c-sharpcorner.com/blogs/date-and-time-format-in-c-sharp-programming1

@* ----------------------------------------
Here's a From To on event dates -----------

if(!@record.IsDBNull("StartDate")){
<p>
<b>
@if(record.GetDateTime("StartDate").ToString("h tt")!="12 AM") {
    @(record.GetDateTime("StartDate").ToString("dddd, MMMM dd yyyy - h:mm tt")) 
}
else {
    @(record.GetDateTime("StartDate").ToString("dddd, MMMM dd yyyy")) 
}
</b>
@if(!@record.IsDBNull("EndDate") && (record.GetDateTime("EndDate").ToString("dddd, MMMM dd yyyy - h:mm tt")!=record.GetDateTime("StartDate").ToString("dddd, MMMM dd yyyy - h:mm tt")) ){
    <b> to 
@if(record.GetDateTime("EndDate").ToString("h tt")!="12 AM") {
    @(record.GetDateTime("EndDate").ToString("dddd, MMMM dd yyyy - h:mm tt")) 
}
else {
    @(record.GetDateTime("EndDate").ToString("dddd, MMMM dd yyyy")) 
}
</b>
}
</p>
---------------- end --------------------
*@