
Signature
Roger Frost
"Logic Is Syntax Independent"
> I have date stored in a DateTime object. I can convert this to a
> string by writing:
[quoted text clipped - 8 lines]
>
> Regards
You'd think there would be an easy way to just get a time returned as 9:00
am for example.
> createdDate.ToString("MMMM dd, yyyy")
>
[quoted text clipped - 16 lines]
>>
>> Regards
Marc Gravell - 25 Feb 2008 15:38 GMT
> 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
Jon Skeet [C# MVP] - 25 Feb 2008 15:41 GMT
> 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
clintonG - 25 Feb 2008 22:47 GMT
Hey guys, thanks for helping me stay lazy this afternoon :-) now I won't
have to slog my way through the docs.
> You'd think there would be an easy way to just get a time returned as 9:00
> am for example.
[quoted text clipped - 19 lines]
>>>
>>> Regards
> 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)

Signature
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
Roger Frost - 26 Feb 2008 06:01 GMT
Noted, Thank you.

Signature
Roger Frost
"Logic Is Syntax Independent"
>> 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)