Jump to content
Sign in to follow this  
Vincent

TickDate

Recommended Posts

Hello Vincent,

 

The values you see are the number of milliseconds that have elapsed since 00:00 hours January 1st 1970 with "\ /" affixes.

 

Use the following C# function to convert to a standard UTC date and time.

    public class JSONParser
    {
        public static DateTime ParseJSONDateToUtc(string jsonDate)
        {
            var ms = Int64.Parse(jsonDate.Replace(@"\/Date(", "").Replace(@")\/", ""));
            var ticks = ms*TimeSpan.TicksPerMillisecond + new DateTime(1970, 1, 1).Ticks;
            return new DateTime(ticks,DateTimeKind.Utc);
        }
    }

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×