Uncategorized

How to convert Json Epoch date string to C# DateTime

  The method below converts a Json Epoch Date string to a .NET string with a given format. public string JsonEpochDateToDateTime(string jsonEpochDate, string resultFormat) { string result = string.Empty; if (jsonEpochDate.Contains(“Date(“) && jsonEpochDate.Contains(“)”)) { jsonEpochDate = jsonEpochDate.Replace(“Date(“, string.Empty).Replace(“)”, string.Empty); } long milliseconds = 0; long.TryParse(jsonEpochDate, out milliseconds); if (milliseconds > 0) { var epochDate = new […]