Error converting datatype datetime2 to datetime in Entity framework


  • Hi Am posting data using WCF RESTful service and EntityFramework. While am posting it am getting this error can anyone give the exact solution and reason for this



    Tuesday, April 23, 2013 5:49 AM


  • This——I suspect whether it's a bug or not……But according to what I see, DateTime2 has extended DateTime so to convert from DateTime2 to DateTime, there must something lost.

    So that's the ERROR.

    And temporary solution is to:

    Use a full constructor for DateTime:

    //Don't use: DateTime dt = new DateTime();

    //Suggested: DateTime dt = new DateTime(2013,12,12,1,1,1);

    If you think one reply solves your problem, please mark it as An Answer, if you think someone's reply helps you, please mark it as a Proposed Answer

    Help by clicking:
    Click here to donate your rice to the poor
    Click to Donate
    Click to feed Dogs & Cats

    Found any spamming-senders? Please report at: Spam Report

    Tuesday, April 23, 2013 6:37 AM