Convert My Date To insert in to table RRS feed

  • Question

  • User2033107836 posted


    My Data format is like this 01.09.2017 

    I want to convert this format so that to save in database 2017-09-01 00:00:00.000

    How To Do So..?

    Thanking You

    Saturday, September 16, 2017 10:29 AM


  • User-1508012637 posted

    Hi asp.ambur,

    According to your description, I suggest you could try DateTime.ParseExact() method.

    Please refer to the following code:

    string mydate = "01.09.2017"; //test string, you could replace it
    DateTime parsedDateTime = DateTime.ParseExact(mydate, "dd.MM.yyyy", null); //the parsedDateTime would be 2017-09-01 00:00:00.000

    Best Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, September 16, 2017 11:54 AM