reverse this function

Posted by ooo on Stack Overflow See other posts from Stack Overflow or by ooo
Published on 2010-05-30T04:05:43Z Indexed on 2010/05/30 4:12 UTC
Read the original article Hit count: 403

Filed under:
|
|

i have code that takes a csharp datetime and converts it into a long to plot in the "flot" graph. here is the code

    public static long GetJavascriptTimestamp(DateTime input)
    {
        TimeSpan span = new TimeSpan(DateTime.Parse("1/1/1970").Ticks);
        DateTime time = input.Subtract(span);
        return (long)(time.Ticks / 10000);
    }

I now need an opposite function where i take this long value and get the csharp datetime object back. any idea if the above method can be reversed ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about JavaScript