Geeks With Blogs
Rodney Vinyard - .NET & SQL Developer When all is said and done, more will be said than done

C# Format Date

 

_attribute =

" effectiveDate=\"" + string.Format("dd/MM/yyyy", _value).ToString() + "\""; Posted on Tuesday, September 12, 2006 1:08 PM | Back to top


Comments on this post: C# Format Date

# re: C# Format Date
Requesting Gravatar...
Code above is Wrong....

string.Format("{0:dd/MM/yyyy}", _value).ToString();

Left by Jeferson Nascimento on Mar 09, 2007 7:32 PM

# re: C# Format Date
Requesting Gravatar...
this code is very useful.:)
Left by ryan(philippines) on Mar 25, 2007 10:07 PM

# re: C# Format Date
Requesting Gravatar...
the above code is wrong.

you have to use like this:

formateddate=DateTime.Now.ToString("dd / MMM/ YYYY");
or
("dd-MM-yy") or ("dd-MMM-YYYY");
Left by zahir on Apr 03, 2008 12:43 AM

# re: C# Format Date
Requesting Gravatar...
Thanks very much
Left by dkl on Aug 14, 2008 4:25 AM

# re: C# Format Date
Requesting Gravatar...
Thanks a lot for this code and comments. :D
Left by AL on Oct 06, 2008 1:53 PM

# re: C# Format Date
Requesting Gravatar...
DateTime dt = DateTime.Now;
string dateString = String.Format("{0:MM/dd/yyyy}",dt)
Left by lotto on Feb 17, 2009 8:26 AM

# re: C# Format Date
Requesting Gravatar...
Thanks Zahir !!!
Left by Nripin on Jul 03, 2009 6:41 AM

# re: C# Format Date
Requesting Gravatar...
thanks zahir
Left by noha on Sep 03, 2009 6:59 AM

# re: C# Format Date
Requesting Gravatar...
Thanks, it worked
Left by Yasir on Oct 10, 2009 4:01 AM

# re: C# Format Date
Requesting Gravatar...
string date = string .Format("DD/MMM/YYYY",DateTime.Now);
it will show output value as "DD/MM/YYYY"
Left by Ganesh on Dec 19, 2010 5:53 AM

# re: C# Format Date
Requesting Gravatar...
good code but instead of dd-mm-YYYY
write dd-mm-yy
or dd-mm-yyyy
Left by snehal on May 30, 2011 7:04 AM

# re: C# Format Date
Requesting Gravatar...
thanks ...
Left by mobi001 on Jun 26, 2011 11:39 AM

# re: C# Format Date
Requesting Gravatar...
thanks it helped me
Left by vikas on Mar 10, 2012 12:05 AM

# re: C# Format Date
Requesting Gravatar...
I am a beginner only in csharp..!!
I wanna know how to check the string entered is in dd-MM-yyyy format??
Pls help..
Left by Mary on Mar 18, 2012 7:20 PM

# re: C# Format Date
Requesting Gravatar...
Convert.ToDatetime(date).ToDstring("dd / MMM/ yyy")
Left by k on May 15, 2012 4:37 AM

# re: C# Format Date
Requesting Gravatar...
I have an issue regarts to the formating to date.

I want it to display "01/Jan/2013" but it display "01-Jan-2013"

This is the code that is use:
DateTime.Now.ToString("dd/MMM/yyyy")

How can i rectify the issue
Left by Ben on Jan 27, 2013 8:33 PM

# re: C# Format Date
Requesting Gravatar...
Console.WriteLine(dt.ToString("d",
CultureInfo.CreateSpecificCulture("en-NZ")));
Left by Dineshprabhu on Feb 14, 2013 10:31 PM

# re: C# Format Date
Requesting Gravatar...
String to yyyy-MM-dd date format:
Example:

TxtCalStDate.Text = Convert.ToDateTime(objItem["StartDate"]).ToString("yyyy/MM/dd");
Left by N.Siva on Feb 17, 2013 6:57 AM

# re: C# Format Date
Requesting Gravatar...
so interesting ,thanks very much
Left by Jordan Shoes on Mar 02, 2013 12:17 AM

# re: C# Format Date
Requesting Gravatar...
Thanks a lot N.Siva!
Left by Lehlohonolo Letaoana on Mar 29, 2013 9:17 AM

# re: C# Format Date
Requesting Gravatar...
Here is one more related topic to explain in a bettor way

down vote


see this http://susheelonline.com/date-time-format-in-c/

here you can get list of format for date and time in C#

still have issue please talk to me

susheel3010@gmail.com
Left by susheel on May 02, 2013 12:54 AM

Your comment:
 (will show your gravatar)


Copyright © Rodney Vinyard | Powered by: GeeksWithBlogs.net | Join free