I am working in crunchbase api. I have got result form Crunchbase api https://developer.crunchbase.com/docs. I did not able to parse given value of Created date and update date to Datetime format using C#
anybody help me to fix this issue ??
I am working in crunchbase api. I have got result form Crunchbase api https://developer.crunchbase.com/docs. I did not able to parse given value of Created date and update date to Datetime format using C#
anybody help me to fix this issue ??
Those numbers are unix timestamps.
Lucky for you, conversion is pretty straightforward since they just represent the time passed in seconds since 01.01.1970
// create a new DateTime for the time timestamps start counting from
var dt = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
var dtDateTime = dt.AddSeconds(myJson.created_at).ToLocalTime();
Where myJson.created_at
is your extracted date time.
Now that you realize what these attributes are, consider this question and answers that explain how to convert a unix timestamp to a C# datetime automatically as part of JSON conversion. Note that question is kind of different, you want seconds and not milliseconds like in that answer.