I'm using .NET Core and want to serialize a date into the same format as the System.Web.Script.JavascriptSerializer, but using Newtonsoft jsonconverter instead (or something else compatible with .NET Core since the JavascriptSerializer is .NET framework).
Example:
DateTime result1;
var dt1 = DateTime.TryParse("12.06.2012 10:34:00",CultureInfo.GetCultureInfo("DA-dk"), DateTimeStyles.None, out result1);
JsonConvert.Serialize(result1);
This does NOT return a format like this that I need: "/Date(1249335477787)/";
How can I get a date like this with .NET Core
Thanks
"\/Date(1560241243104+0200)\/", then the way to do that is to specify a JsonSerializerSettings object where you setsettings.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat;+0200.