Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#ASP.NET
i have to convert any datetime format to dd/mm/yyyy format. how i can do this.i have try this but not working.
 

 
(Convert.ToDateTime(txt_NextPaymentDate.Text).ToString("dd/MM/yyyy"))
Posted 25-Jan-13 1:07am
Comments
Zoltán Zörgő at 25-Jan-13 7:11am
   
It depends what's in txt_NextPaymentDate.Text. What have you tried?
OriginalGriff at 25-Jan-13 7:12am
   
"i have try this but not working." Is not a helpful error report - we cannot work out from that little what you are trying to do. Remember that we can't see your screen, access your HDD, or read your mind. Use the "Improve question" widget to edit your question and provide better information.
Deenuji at 25-Jan-13 7:32am
   
sir my doubt is http://www.codeproject.com/Questions/534270/howplustoplusbindpluslistboxplusitemsplustoplusgri
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

check out Link1[^] or
 
Link2[^] for more details in datetime format
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

DateTime dt = DateTime.ParseExact(yourObject.ToString(), "MM/dd/yyyy hh:mm:ss tt", CultureInfo.InvariantCulture);
 
string s = dt.ToString("dd/MM/yyyy");
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hii Professional
 
i think its helpfull for you....

DateTime dt = DateTime.ParseExact(txt_NextPaymentDate.Text.ToString(), "MM/dd/yyyy hh:mm:ss tt", CultureInfo.InvariantCulture);
 
string s = dt.ToString("dd/M/yyyy");
  Permalink  
Comments
Marcus Kramer at 23-Feb-13 11:28am
   
My 1. Same answer as Solution 1. Reported as repost.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Try this one:
String.Format(@"{0:dd\/MM\/yyyy}", Convert.ToDateTime(txt_NextPaymentDate.Text))
This one gives 01/01/2012, so it works:
String.Format(@"{0:dd\/MM\/yyyy}", Convert.ToDateTime("2012-01-01"))
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

Convert.ToDateTime(dateString, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat).ToShortDateString();
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

HI,
 
Checkout the following link for the formating purpose in the date and time case.
 
string-format-datetime
 
Thanks
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5


Try this one,
IFormatProvider provider = new System.Globalization.CultureInfo("en-CA", true);
DateTime fDate = DateTime.Parse(urTxtBoxId.Value, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
 
string date=fDate.ToString("dd/MM/yyyy"))
 
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 686
1 OriginalGriff 498
2 Tadit Dash 420
3 sanket saxena 337
4 Zoltán Zörgő 230
0 Sergey Alexandrovich Kryukov 11,800
1 OriginalGriff 7,225
2 Peter Leow 5,009
3 Abhinav S 3,893
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web01 | 2.8.140421.2 | Last Updated 25 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid