0

when I read data value it changed. i need this string value 2018-03-27T20:00:00+11:00 but getting 3/27/2018 2:00:00 PM in mydate string.

 static void Main(string[] args)
    {
        string data="{\"start_date\":\"2018-03-27T20:00:00+11:00\",\"end_date\":null,\"on_sale_date\":\"2017-11-24T08:55:00+11:00\",\"date_confirmed\":true}";
        JObject pdata = JObject.Parse(data);
        string mydate = pdata["start_date"].ToString();

    }
2

1 Answer 1

0

I think it is not possible to disable the DateParseHandling with JObject.Parse.
You can use the DeserializeObject methode from JsonConvert and disable the DateParseHandling:

string data = "{\"start_date\":\"2018-03-27T20:00:00+11:00\",\"end_date\":null,\"on_sale_date\":\"2017-11-24T08:55:00+11:00\",\"date_confirmed\":true}";
dynamic pdata = JsonConvert.DeserializeObject(data, new JsonSerializerSettings()
{
    DateParseHandling = DateParseHandling.None
});
string mydate = pdata.start_date;
Console.WriteLine(mydate);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.