Format date to convert into words

W

weird0

I have date stored in a DateTime object. I can convert this to a
string by writing:

createdDate.ToString("dd/mm/yy")

Is there anyway, I can format the date in words along with a comma.

So, the date looks something like Dec 8, 2006.

Dont wanna go thur the hassle of writing all the code.

Regards
 
C

clintonG

You'd think there would be an easy way to just get a time returned as 9:00
am for example.
 
M

Marc Gravell

You'd think there would be an easy way to just get a time returned as 9:00
am for example.


You mean like .ToString("h:mm tt")?

Of course, you could use "t" or ToShortTimeString() [etc] to get what
the user chooses as their time format

Marc
 
J

Jon Skeet [C# MVP]

You'd think there would be an easy way to just get a time returned as 9:00
am for example.

Is it so hard to call dt.ToString("h:mm tt")?

If this happens to be a format you want to use frequently, stick it
into a constant. Don't forget that lots of people want subtly
different formats - and different formats are preferred in different
international contexts.

Jon
 
C

clintonG

Hey guys, thanks for helping me stay lazy this afternoon :) now I won't
have to slog my way through the docs.
 
M

Mihai N.

createdDate.ToString("MMMM dd, yyyy")
You should go with a standard format (see Marc's answer).
That is culture-sensitive (the right thing), while using
an explicite patern will result in an American format
(even if the culture is French, and the month name,
is French, for example)
 

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

Top