Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
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 !! Wink | ;)
Posted 16-Jan-11 21:20pm
Edited 16-Jan-11 22:37pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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 Smile | :)
  Permalink  
v2
Comments
SAKryukov at 17-Jan-11 8:48am
   
Right, my 5.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
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[^].
  Permalink  
v2
Comments
SAKryukov at 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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

See here[^].
  Permalink  
Comments
rahu_122 at 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 at 17-Jan-11 2:51am
   
This might help - http://msdn.microsoft.com/en-us/library/x2bh6292(v=vs.80).aspx
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

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("dd MMM,yyyy",CultureInfo.GetCultureInfoByIetfLanguageTag("fr-FR"));
Label2.Text = System.DateTime.Now.ToString("dddd", CultureInfo.GetCultureInfoByIetfLanguageTag("fr-FR"));
    }</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, Shucks | :-\
AshishCool | :cool:
  Permalink  

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

  Print Answers RSS
0 DamithSL 320
1 OriginalGriff 195
2 Afzaal Ahmad Zeeshan 154
3 Zoltán Zörgő 149
4 Peter Leow 115
0 OriginalGriff 7,510
1 DamithSL 5,519
2 Sergey Alexandrovich Kryukov 4,994
3 Maciej Los 4,936
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 6 Feb 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100