Archive

Posts Tagged ‘DateTime.Parse’

C# : How to Create a DateTime object from a string date

December 14th, 2009 Shyju No comments

In C#, Creating a DateTime object from a Date String is as follows.

string strStartDate=”11/11/2009″;

DateTime objStartDate = DateTime.Parse(strStartDate);

The objStartDate object,which is an object of DateTime class,  is now holding the date and u can use this object for all date manipulation functions

Always use DateTime wherever handling the dates instead of using String.DateTime gives u flexibility to work more on that like performing date manipulation

Categories: C# Tags: , , ,