Date Format in Custom Web Part

Date Format in Custom Web Part

When creating a custom webpart and you use the Calendar form control you can use one of the date formats to display your date/time data.

Date Format in Custom Web Part

Date Format in Custom Web Part

<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("MM/dd/yyyy") %>
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("dddd, dd MMMM yyyy") %> 
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("dddd, dd MMMM yyyy") %> 
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("dddd, dd MMMM yyyy") %> 
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("dddd, dd MMMM yyyy") %>  
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("dddd, dd MMMM yyyy") %>  
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("dddd, dd MMMM yyyy HH:mm:ss") %> 
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("MM/dd/yyyy HH:mm") %> 
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("MM/dd/yyyy hh:mm tt") %> 
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("MM/dd/yyyy H:mm") %> 
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("MM/dd/yyyy h:mm tt") %> 
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("MM/dd/yyyy HH:mm:ss") %> 
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("MMMM dd") %> 
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss.fffffffK") %>  
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("ddd, dd MMM yyy HH’:’mm’:’ss ‘GMT’") %>  
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss") %>  
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("HH:mm") %> 
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("hh:mm tt") %> 
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("H:mm") %>;  
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("h:mm tt") %>  
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("HH:mm:ss") %>  
<%= Convert.ToDateTime(GetValue("YourDateField")).ToString("yyyy MMMM") %>