-
August 16th, 2007, 08:56 AM
#1
Date Formatting Problem
Hi,
I am trying to format the date display but i find problem while formatting the year part
DateTime dt2 = new DateTime(03,02,01);
Console.WriteLine(dt2.ToString("dd-MMM-yyyy"));
Output is 01-Feb-0003
Required output is 01-Feb-2003
Note:- The input date arguments comes from another logic with only in 'yy' format i need to convert it to 'yyyy' format
Thanks in advance for the help
Anand
-
August 16th, 2007, 09:06 AM
#2
Re: Date Formatting Problem
generally
The DateTime value type represents dates and times with values ranging from 12:00:00 midnight, January 1, 0001 Anno Domini (Common Era) through 11:59:59 P.M., December 31, 9999 A.D. (C.E.)
so implement at your function to convert 03 to 2003, or may be 1903
-
August 16th, 2007, 09:42 AM
#3
Re: Date Formatting Problem
I think u can use String.Format()
-
August 17th, 2007, 01:43 AM
#4
Re: Date Formatting Problem
The format what you are using is correct.
Try This
DateTime dt = DateTime.Now;
string stemp=dt.ToString("MMMM dd yyyy");
Regards
Ravi.Battula
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|