Click here to Skip to main content
15,867,901 members
Please Sign up or sign in to vote.
3.50/5 (3 votes)
See more:
Hi,

I'm facing an issue displaying English date to French format.
I want to display current date in French culture(fr-FR) format as example given below :

English date : 01/20/2011 08:23 pm
French date : 20/01/2011 20:23

Could anybody help in this regard.

Thanks in advanced !! ;)
Posted
Updated 16-Jan-11 21:37pm
v2

I feel I must point out that the example you used:

English date : 01/20/2011 08:23 pm

Is not the English Date.

The English Date Format is the same as the French Date Format.

ie Day/Month/Year.

Month/Day/Year is the totally illogical order used by Americans.


But surely just assigning it to the French Culture will be enough for the Date to be presented properly?

CultureInfo("fr-FR") should do the trick.
 
Share this answer
 
v2
Hi All,

I got solution wht i was looking for ,

I wrote following code to display date in french culture format as given below :

Now.ToString(Globalization.CultureInfo.CreateSpecificCulture("fr-FR"))

Thanks for all your valuable inputs.
Rahul Chitte :)
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 17-Jan-11 8:48am    
Right, my 5.
Doing this ad hoc is easy. Read this:

http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx[^].

However, mixing up cultures in the same run-time of the same application? Hm...

If you want to change culture of the application, the reference by Abhinav may need an extra note. You also need to understand the difference between
System.Threading.Thread.CurrentThread.CurrentCulture<br />
and System.Threading.Thread.CurrentThread.CurrentUICulture.

See the description in Microsoft help. This is an interesting comprehensive article on the topic: http://www.devx.com/dotnet/Article/6997[^].

Short and clear article in Dr.Dobbs: http://www.drdobbs.com/windows/206901403[^].
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 17-Jan-11 9:26am    
Oh, I agree, my Answer is pretty bad.

The only correct Answer (to this particular question) is by rahu_122 -- to his own Question, which I credit with a vote of 5.
See here[^].
 
Share this answer
 
Comments
Rahul Chitte 17-Jan-11 2:30am    
Yes this answer seems to be correct but it changes the setting for whole application, hence i m getting exception for adding decimal variables in french format.
So is it possible to apply change for only specific variable or object?
Abhinav S 17-Jan-11 2:51am    
This might help - http://msdn.microsoft.com/en-us/library/x2bh6292(v=vs.80).aspx
I got another better solution.
[in ASP.NET 3.5, C#]
take two labels in "default.aspx"
'Label1' & 'Label2'
now come to the CODE VIEW
add namespace in your code

using System.Globalization;

then enter the specifics code in PAGE_Load event:
protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = System.DateTime.Now.ToString(&quot;dd MMM,yyyy&quot;,CultureInfo.GetCultureInfoByIetfLanguageTag(&quot;fr-FR&quot;));
Label2.Text = System.DateTime.Now.ToString(&quot;dddd&quot;, CultureInfo.GetCultureInfoByIetfLanguageTag(&quot;fr-FR&quot;));
    }</pre>

you also can use your own date format.
there is some examples of the date-Time Format:

"dd-mm-yy" - 01-01-11
"dd-mmm-yyyy" - 01-jan-2011
"dd mmmm, yyyy" - 01 january, 2011
"dd mmmm, yyyy, hh:mm:ss" - 01 january, 2011, 13:30:15

see ya, :-\
Ashish:cool:
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900