0

Can someone guide me to convert timestamp. I am able to convert using various formulas like below, but it shows wrong dates. For example the timestamp 136006971590000000 I know is between October 10th and October 12th 2013, but it shows Feb 2013. I am using DBISQL (sybase). Below are some of the queries I am using but none of them show correct time.

  1. select dateadd(ms, 136006971590000000-(1360069715900/1000)*1000, dateadd(ss, 1360069715900000000/1000+8*60*60, '19700101'))

  2. select dateadd(second, 136006971590000000/100000000+8*60*60, '19700101')

  • UNIX timestamps are 10 digits. The ones you provide seem a little long – Cillier Oct 15 '13 at 16:37
  • Where did you get the timestamp from? It's *not* a Unix timestamp in the normal sense - either in seconds, milliseconds or microseconds. (In microseconds since the Unix epoch, it's Feb 2013.) – Jon Skeet Oct 15 '13 at 16:38
  • Thanks Cillier, I tried that too. Still shows Feb 2013. – user2856752 Oct 15 '13 at 16:39
  • Jon, This is where I am perplexed. I am using DBI SQL which is Sybase tool – user2856752 Oct 15 '13 at 16:43
  • I am pulling starttime and endtime between Oct1oth and Oct12th which gives me starttime 136006971590000000. Now, I convert the same time using the above query and it shows Feb2013. – user2856752 Oct 15 '13 at 16:47
  • If you are using Sybase, why did you tag your question with `mysql`? That's a completely different product. – Andriy M Oct 17 '13 at 03:10

1 Answers1

0

could your 18 digit timestamps be LDAP & Active Directory Timestamps ?? (from google search for 18 digit timestamp)

I found this here: 18 digit timestamp?

If you need to convert from those numbers to Unix time, subtract 621355968000000000L, which is the Unix epoch expressed in ticks.

Community
  • 1
  • 1
BWS
  • 3,786
  • 18
  • 25
  • Thank you BWS. Do you have a complete query by any chance? I googled 18 digit timestamp and got online converter. It shows GMT: Sun, 28 Dec 2031 11:25:59 GMT. http://www.epochconverter.com/epoch/ldap-timestamp.php – user2856752 Oct 15 '13 at 17:19
  • did this link help? http://stackoverflow.com/questions/1832714/18-digit-timestamp – BWS Oct 15 '13 at 17:25