Skip to content
Loading
  • Ananth G
    +1
    if answer correct , then accept it... others will know which answer is correct
    +1
  • Bikesh Srivastava
    +1
    you can use datetime.parse(string);
    +1
  • Khaja Moizuddin
    +1
    You can use Convert.ToDateTime(textbox1.Text);
    +1
  • Afzaal Ahmad Zeeshan
    +1
    The only problem is that you are having the value as string. You need to pass it as  variable. 
    1. bjJobBL.JobDate =Convert.ToDateTime("txtDate.Text"); // Remove ""  
    2.   
    3. // Like  
    4. bjJobBL.JobDate =Convert.ToDateTime(txtDate.Text);  
    This will remove the error in your code.  
    +1
  • Afzaal Ahmad Zeeshan
    +1
    @Ananth G: Only post one time as a solution, initially. Posting multiple times is not a good approach at helping people. All of your posts can be a single one. I hope you will not abuse the forums anymore. :-) 
    +1
  • Ananth G
    0
    1. CultureInfo culture = new CultureInfo("en-US");      
    2. DateTime tempDate = Convert.ToDateTime("1/1/2010 12:10:15 PM", culture);      
    0
  • 0
    Thanks.......
    0
  • 0
    if (pnltxtDate.Text != "")
    {
    objJobBL.JobDate = Convert.ToDateTime(pnltxtDate.Text);//stringToDateConversion(pnltxtDate.Text, "dd/MM/yyyy");
    }
    else
    {
    objJobBL.JobDate = null;
    }
     
    this works for me... 
    0
  • Harshal Patil
    0
     

    DateTime date = Convert.ToDateTime   ("txtDate.Text",System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat);

    0