[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Change Date Format programically

Posted on 2004-09-08
7
Medium Priority
?
331 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

649 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