Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 877741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:39:36+00:00 2026-05-15T11:39:36+00:00

I have a integer column in MySql storing the DateTime.Ticks. A single tick represents

  • 0

I have a integer column in MySql storing the DateTime.Ticks.

A single tick represents one hundred nanoseconds or one ten-millionth of a second. There are 10,000 ticks in a millisecond.

The value of this property represents the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001

How can I convert this to a DateTime in a query? I’ve tried many things, but cannot get it to work.

For the ticks 634128921500016150 I hope to get the mysql datetime ‘2010-06-23 12:06:50’

I would have believed the following should work, but it gives ‘4009-06-22 12:15:50.001600’. It seems it’s off by 2001 years, 1 day and 9 minutes… If the years and days is consistent, I can just fix it manually, but the minutes seems a little odd.

SELECT DATE_ADD('0000-01-01 00:00:00',
  INTERVAL 634128921500016150/10000000 SECOND_MICROSECOND);

I’ve tried adding more zeros, but it never matches 😐

I also tried Jon Skeet’s suggestion, but it gives nearly the same result (some fraction of a second different)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:39:36+00:00Added an answer on May 15, 2026 at 11:39 am

    Rather than adding using SECOND_MICROSECOND, try just adding via MICROSECOND:

    SELECT DATE_ADD('0001-01-01 00:00:00',
      INTERVAL 634121049314500000/10 MICROSECOND);
    

    EDIT: I’ve just worked out why the years are so wrong. MySQL’s minimum date is the year 1000. So I suggest you change it to:

    SELECT DATE_ADD('0001-01-01 00:00:00',
      INTERVAL (634121049314500000 - base_ticks)/10 MICROSECOND);
    

    where base_ticks is the value of the ticks from new DateTime(1001, 1, 1).Ticks.

    Heck, you could rebase wherever you want (e.g. 2000) – that might even work round the 9 minutes issue. It’s possible that it’s making up for leap seconds over the years, or something like that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 454k
  • Answers 454k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I guess you could use Interfacebuilder to write your Window-class… May 15, 2026 at 9:50 pm
  • Editorial Team
    Editorial Team added an answer Square brackets with indexes seem to be what most frameworks… May 15, 2026 at 9:50 pm
  • Editorial Team
    Editorial Team added an answer $(cell).css("background-image","url('mybg.png)"); May 15, 2026 at 9:50 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.