Netmonster wrote:
On Aug 13, 2:13 pm, Netmonster <netmonster...@yahoo.comwrote:
>On Aug 13, 12:42 pm, John <J...@discussions.microsoft.comwrote:
>>Experts,
How can I format 8/1/2008 into Aug-1-2008?
Thank you very much.
C#
DateTime.Parse("8/1/2008").ToString("MMM - dd- yyy");
sry forgot to complete the year.
DateTime.Parse("8/1/2008").ToString("MMM-dd-yyyy");
That code depends on the setup of Windows.
On my PC it returns Jan-8-2008 !
Use:
DateTime.ParseExact(s, "M/d/yyyy",
CultureInfo.InvariantCulture).ToString("MMM-dd-yyyy")
to enforce the correct interpretation of the input.
Arne