Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can create your own custom format provider to get this specific dateformat <strong>"Friday Nov 29th 2013"</strong></p> <pre><code>public class SuffiexFormattedDateProvider : IFormatProvider, ICustomFormatter { /// &lt;summary&gt; /// Returns an object that provides formatting services for the specified type. /// &lt;/summary&gt; /// &lt;param name="formatType"&gt;An object that specifies the type of format object to return.&lt;/param&gt; /// &lt;returns&gt; /// An instance of the object specified by &lt;paramref name="formatType" /&gt;, if the &lt;see cref="T:System.IFormatProvider" /&gt; implementation can supply that type of object; otherwise, null. /// &lt;/returns&gt; public object GetFormat(Type formatType) { if (formatType == typeof(ICustomFormatter)) return this; return null; } /// &lt;summary&gt; /// Converts the value of a specified object to an equivalent string representation using specified format and culture-specific formatting information. /// &lt;/summary&gt; /// &lt;param name="format"&gt;A format string containing formatting specifications.&lt;/param&gt; /// &lt;param name="arg"&gt;An object to format.&lt;/param&gt; /// &lt;param name="formatProvider"&gt;An object that supplies format information about the current instance.&lt;/param&gt; /// &lt;returns&gt; /// The string representation of the value of &lt;paramref name="arg" /&gt;, formatted as specified by &lt;paramref name="format" /&gt; and &lt;paramref name="formatProvider" /&gt;. /// &lt;/returns&gt; /// &lt;exception cref="System.NotSupportedException"&gt;&lt;/exception&gt; public string Format(string format, object arg, IFormatProvider formatProvider) { if (!(arg is DateTime)) throw new NotSupportedException(); var dt = (DateTime)arg; string suffix; if (dt.Day % 10 == 1) { suffix = "st"; } else if (dt.Day % 10 == 2) { suffix = "nd"; } else if (dt.Day % 10 == 3) { suffix = "rd"; } else { suffix = "th"; } return string.Format("{0:dddd MMM} {1}{2}, {0:yyyy}", arg, dt.Day, suffix); } } </code></pre> <p>Then you can use this as</p> <pre><code>string formatDateString = string.Format(new SuffiexFormattedDateProvider(), "{0}", DateTime.Now); </code></pre> <p>Output:- <strong>"Friday Nov 29th, 2013"</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload