Rob DiNardo - Web Development Tips

Home

csharp

warning: Creating default object from empty value in /var/www/robdinardo.com/public_html/modules/taxonomy/taxonomy.pages.inc on line 34.

Convert string to DateTime or output DateTime to string using .NET

Rob — December 1, 2010 - 20:14

I often times come across a situation where I have a string in a certain date time format and wish to convert that string into a .NET DateTime object for further manipulation.  In one recent situation, a date was supplied in an XML node (without a specified data type) as a string, but the output of the date had to be in a specific format for my client. 

Example:  We need to convert <submit_date>2010-12-04 13:22:32</submit_date> and output it as December 4, 2010 at 1:22 PM 

  • .NET
  • c#
  • coding
  • csharp
  • Reference
  • Rob's blog
  • Read more
Syndicate content

User login

  • Request new password

Code

  • WordPress Plugins