all groups > c# > february 2005 >
You're in the

c#

group:

Custom format in DateTimePicker


Custom format in DateTimePicker Guy Corriveau
2/28/2005 10:57:07 PM
c#: Got a dateTimePicker o

o.Format = DateTimePickerFormat.Custom;

o.CustomFormat = "MM/dd/yyyy hh:mm tt";

the previous code work well when the Regional option is set to english
Canadian but do not display the AM or PM when the Regional option is set to
french canadian

Re: Custom format in DateTimePicker gerry
3/1/2005 9:15:15 AM
ok - so what does AM / PM mean in any language other than latin ?





[quoted text, click to view]

Re: Custom format in DateTimePicker Cor Ligthert
3/1/2005 12:44:38 PM
Guy,

I am curious because in my opinion is the behaviour more than correct.

Is in French Canadian the PM and AM used and what does it than mean in the
French language?

You can use very terrible constructions by setting the culture of the UI in
the constructor. However, I find that terrible because that is not changeble
than in anyway and really is your application than fixed for one culture.
You have to do that for the base class as well when you inherit your forms.

Maybe this helps

Cor

Re: Custom format in DateTimePicker Cor Ligthert
3/1/2005 12:46:27 PM
doh,

I think I make a mistake, because I thought that for the DateTimePicker even
that changing in the constructor does not work.

Cor

Re: Custom format in DateTimePicker Guy Corriveau
3/1/2005 4:40:43 PM
In fact, the interface of the software in working on, can be display in
french or English on a Click, and I made custom setting on the
datePicker to be sure, if the software is use in french the datePicker
will be in french, if the software is use in english the datePicker will
display date in english format.

When i try the code,
I put the regional setting in english
Software in engish display
the date picker display in english 12/01/2005 10:00 PM
software in french display
the date picker display in french 01-12-2005 22:00

I put the regional setting in french
Software in engish display
the date picker display in english 12/01/2005 10:00
software in french display
the date picker display in french 01-12-2005 22:00






*** Sent via Developersdex http://www.developersdex.com ***
Re: Custom format in DateTimePicker Cor Ligthert
3/2/2005 2:46:45 PM
Guy,

One word, it is not the English format.

That is the language, what you are using is the US or English Canada culture
for date and time and the standard French way for that.

In most English speaking countries is the English way of datetime used.

See this page from the BBC I think it cannot be more English than that.

http://www.bbc.co.uk/cgi-perl/whatson/search/grid.cgi?MEDIUM=radio

I hope this helps

Cor

Re: Custom format in DateTimePicker Guy Corriveau
3/2/2005 6:09:27 PM
December the 31 2004 at 10:00 PM

Why in this case the display show
with string to custom format "MM/dd/yyyy hh:mm tt"
12/31/2004 10:00 PM regional setting in english
12/31/2004 10:00 regional setting in french

and "dd-MM-yyyy HH:mm"
31-12-2004 22:00 regional setting in english
31-12-2004 22:00 regional setting in french



*** Sent via Developersdex http://www.developersdex.com ***
Re: Custom format in DateTimePicker Cor Ligthert
3/3/2005 8:19:19 AM
Guy,

Because you did hard coded your format, in my opinion something nobody
should ever do.

But you can use the short words as in this case probably the best is the
standard ()
string st = dt.ToString()

See here the posibilities on that
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatetimeclasstostringtopic4.asp

I hope this helps?

Cor

AddThis Social Bookmark Button