Home » C#

Convert string to datetime and datetime to string in C#

27 January 2009 149 views No Comment Popularity: 2% Share/Bookmark

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);

From Mukesh Chapagain's Blog | Post Convert string to datetime and datetime to string in C#

Related posts:

  1. jQuery: How to replace string, div content and image src?
  2. Random number, string generation in PHP
  3. PHP: Simple and easy way to format URL string
  4. Displaying date and time
  5. PHP: How to get integer or decimal from a string?

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.