how to convert a string into datetime in c#

How to convert a string into datetime in c#

step-1:

   First include this namespace
   using System.Globalization;

Step-2:

    Use the following code.

DateTime datetime = DateTime.ParseExact("01-may-1990", "dd-MMMM-yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None);            

Comments

Popular posts from this blog

Upload Single/Multiple file by using the REST API and jQuery SharePoint 2013

A type named 'SP.Data. could not be resolved by the model error

Add content type to SharePoint List/Library using REST API