I am fetching datetime from SQL Server using Entity Framework. The format in my database is 2013-01-01 00:00:00.000 where as when I get it via Entity Framework in JSON format, it is "\\/Date(1356980400000+0500)\\/".
Here is my code
public class SurveyData
{
[DataMember]
public DateTime? CreatedDate { get; set; }
}
var surveyDataList = (from survey in context.FDT_SURVEY
where survey.Name == surveyName
select new SurveyData
{
SurveyID = SqlFunctions.StringConvert((double)survey.SURVEY_ID).Trim(),
CreatedDate = survey.CREATED_DATE,
}
);
in my database, the datatype of CREATED_DATE is datetime.
Unable to understand what is the issue. Any help !
DATETIMEin SQL Server is not stored in any string format - it's stored as an 8 byte datatype. SQL Server dates don't have any format associated with them by default. The date you're showing in JSON is the standard JSON encoding. So what's the problem with that??