Home » C#

Convert string to datetime and datetime to string in C#

27 January 2009 30 views No Comment

convert string to datetime

string datestring = “18 March 2008″;
DateTime parseddate = Convert.ToDateTime(datestring);
Response.Write(parseddate);

convert datetime to string

DateTime dtime = DateTime.Today;
string date = dtime.ToString(“yyyyMMdd”);
Response.Write(date);

Popularity: 1%

Related posts:

  1. Random number, string generation in PHP
  2. Displaying date and time
  3. jQuery: How to replace string, div content and image src?
Share/Bookmark
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.