[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Change Date Format programically

Posted on 2004-09-08
7
Medium Priority
?
343 Views
Last Modified: 2009-04-02
how can i change date format from mm/dd/yyyy to dd/mm/yyyy programically
further more only my app use the new format (dd/mm/yyyy), all others still use the old one
0
Comment
Question by:nghiaap
7 Comments
 
LVL 19

Accepted Solution

by:
Fahad Mukhtar earned 600 total points
ID: 12004491
using System.Globalization;

CultureInfo myc = new CultureInfo("en-GB",true);
myc.DateTimeFormat.ShortDatePattern = "dd/mm/yyyy";                  
Application.CurrentCulture = myc;

MessageBox.Show(DateTime.Now.ToShortDateString());
0
 
LVL 19

Expert Comment

by:Fahad Mukhtar
ID: 12004497
only your application will use this format now..dd/mm/yyyy
0
 
LVL 23

Assisted Solution

by:rama_krishna580
rama_krishna580 earned 600 total points
ID: 12005742
Hi,

International Date and Time
You can use the session.lcid property to change the formatting of the date and time.

For example
<%session.lcid=2057%>
will set the date and time to UK format (DD/MM/YYYY instead of MM/DD/YYYY ) Here's a list of international locales. Bear in mind that setting these will also change currency formatting.

Locale ID (LCID) Description
1033 General Unicode
33280 Binary Order
1027 Catalan
197636 Chinese Bopomofo (Taiwan)
2052 Chinese Punctuation
133124 Chinese Stroke Count
1028 Chinese Stroke Count (Taiwan)
1050 Croatian
1029 Czech
1043 Dutch
1061  Estonian
1036 French
66615 Georgian Modern
1031 German
66567 German Phone Book
1038 Hungarian
66574 Hungarian Technical
1039 Icelandic
1040 Italian
1041 Japanese
66577 Japanese Unicode
1042 Korean
66578 Korean Unicode
1062 Latvian
1063 Lithuanian
1071  FYRO Macedonian
1044 Norwegian/Danish
1045 Polish
1046 Portuguese
1048 Romanian
1051 Slovak
1060 Slovenian
1034 Spanish (Traditional)
3082 Spanish (Spain)
1053 Swedish/Finnish
1054 Thai
2057 UK English
1058  Ukrainian
1066 Vietnamese  

best of luck...

R.K
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Expert Comment

by:shilpa2784
ID: 12024893
Try this,

CultureInfo ci = new CultureInfo("en-GB",true);
ci.DateTimeFormat.ShortDatePattern = "dd/mm/yyyy";
Application.CurrentCulture = ci;
0
 
LVL 19

Expert Comment

by:Fahad Mukhtar
ID: 12025484
shilpa2784 ,
why didnt you bothered to change the variable name from my code ? (myc to ci)


0
 
LVL 1

Author Comment

by:nghiaap
ID: 12032452
wa
there are tons of ways,
thanks u very much
i'll try all of them
0
 
LVL 1

Author Comment

by:nghiaap
ID: 12041086
hi, rama_krishna580
do you mean that your solution for web application
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question