Date Formats (C#)

G

Guest

Hi,

I have a date in a string as say "20/3/2007"

I want to format this as "Mar-07"

This seems to be not that straightforward in C#

In VB6 I could do this easily.

How can I format this to be "MMM - YY" ?
 
M

Mark Rae

Hi,

I have a date in a string as say "20/3/2007"

I want to format this as "Mar-07"

This seems to be not that straightforward in C#

In VB6 I could do this easily.

How can I format this to be "MMM - YY" ?

string strDate = DateTime.ParseExact("20/3/2007", "dd/M/yyyy",
null).ToString("MMM-yy");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top