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 629237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:43:26+00:00 2026-05-13T19:43:26+00:00

I got a table with some time data in the format of yyyymmddMilliseconds. For

  • 0

I got a table with some time data in the format of yyyymmddMilliseconds. For example, 20100218000051234. How to convert this into DateTime type? In SQL Server 2008.

  • 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-13T19:43:27+00:00Added an answer on May 13, 2026 at 7:43 pm

    Interestingly, if you are using SQL Server 2005 and prior, you won’t get the exact precision you want because DateTime values are rounded to increments of .000, .003 or .007. Thus, 51.234 becomes 51.233. However, if you use DateTime2, you can get the precision you want:

    declare @x varchar(50)
    set @x='20100218000051234'
    Select DateAdd(ms, Cast(Substring(@x, 9, 9) As int), Cast(Substring(@x, 1, 8) As datetime))
    Select DateAdd(ms, Cast(Substring(@x, 9, 9) As int), Cast(Substring(@x, 1, 8) As datetime2))
    
    Results:
    2010-02-18 00:00:51.233 
    2010-02-18 00:00:51.2340000
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got an SQL table that I use to keep product data. Some products
I've got some data I'd like to pull off our SQL server. This old
I've got a table that has some <input type=text> boxes in it, and I
I've got a table in which there are some columns with big text data.
Parsing some data and inserting it into 3 tables from .NET. Using Table Valued
I'm working on db2. I got one table, which contains some data: Data |
Some time ago I asked the question SQL Server: How do I maintain data
i've got some form input elements in an html table like this: <table> <thead>
I've got some code to convert a large (many gigabytes) XML file into another
Time for another silly question :) I got some tables in a xhtml-document with

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.