Home > DeveloperSection > Forums > How do I convert string value to a date format
Samuel Fernandes
Samuel Fernandes

Total Post:154

Points:1082
Posted on    January-25-2014 1:30 AM

 C# C# 
Ratings:


 1 Reply(s)
 713  View(s)
Rate this:

How do I convert string value to a date format

string strDateFrom;

string strDateTo;              

CrystalDecisions.Shared.ParameterDiscreteValue DateValue = new CrystalDecisions.Shared.ParameterDiscreteValue();

if ((strDateFrom != "") && (strDateTo != ""))     

{                                      

    DateValue.Value = "(From: " + strDateFrom + " - " + strDateTo + ")";

}    

else    

{

    DateValue.Value = "(ALL DATES)";   

}



Pravesh Singh

Total Post:411

Points:2881
Posted on    January-25-2014 1:49 AM

Hi Samuel,

You can use DateTime.Parse

string date = "2020-02-02";

    DateTime time = DateTime.Parse(date);

    Console.WriteLine(time);

Or use:

DateTime oDate = DateTime.Parse(string s);


Don't want to miss updates? Please click the below button!

Follow MindStick