Convert local time (10 digit number) to a readable datetime format

Posted by djerry on Stack Overflow See other posts from Stack Overflow or by djerry
Published on 2010-03-19T13:40:52Z Indexed on 2010/03/19 13:51 UTC
Read the original article Hit count: 357

Filed under:
|
|
|

Hey all,

I'm working with pbx for voip calls. One aspect of pbx is that you can choose to receive CDR packages. Those packages have 2 timestamps : "utc" and "local", but both seem to always be the same.

Here's an example of a timestamp : "1268927156".

At first sight, there seems to be no logic in it. So i tried converting it several ways, but with no good result. That value should provide a time around 11am (+1GMT) today.

Things i tried:

  • Datetime dt = new Datetime(number);
  • Timespan ts = new Timespan(number);
  • DateTime utc = new DateTime(number + 504911232000000000, DateTimeKind.Utc)

and some others i can't remember right now.

Am i missing something stupid here?

Thanks in advance

© Stack Overflow or respective owner

Related posts about c#

Related posts about datetime