C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...









How to Convert date format from MM/dd/yyyy to dd/MM/yyyy


Posted Date: 07 Jun 2008    Resource Type: Code Snippets    Category: Date & Time

Posted By: Srinivas        Member Level: Gold
Rating:     Points: 10



we can convert MM/dd/yyyy format to dd/MM/yyyy format using the class DateTimeFormatInfo. Here follows the code snippet:


DateTime dt = Calendar1.SelectedDate;
string date = dt.ToShortDateString();
DateTimeFormatInfo dateTimeFormatterProvider = DateTimeFormatInfo.CurrentInfo.Clone() as DateTimeFormatInfo;
dateTimeFormatterProvider.ShortDatePattern = "MM/dd/yyyy";
DateTime dateTime = DateTime.Parse(date, dateTimeFormatterProvider);
string formatted = dateTime.ToString("dd/MM/yyyy");
Response.Write(formatted);




Responses

Author: Kapil Dhawan    17 Jun 2008Member Level: Gold   Points : 2
Hello
Nice piece of code
Thanks for sharing your knowledge with us.
I hope to see more good code from your side
This code is going to help lots of guys.
Ton Thanks to you
Regards,
Kapil



Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Date  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Adjust ASP.NET CalendarControl to show Next Month
Previous Resource: Get total number of days between two months in different year
Return to Discussion Resource Index
Post New Resource
Category: Date & Time


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design   Scripts

audio conferencing services

Contact Us    Privacy Policy    Terms Of Use