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

  • Home
  • SEARCH
  • 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 9252597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:59:10+00:00 2026-06-18T10:59:10+00:00

Consider the following query (in MSSQL 2008): SELECT dateModified FROM SomeTable; This returns floats

  • 0

Consider the following query (in MSSQL 2008):

SELECT dateModified FROM SomeTable;

This returns floats in javascript format (milliseconds since 1970):

dateModified 
============ 
1301598290687 
1071003581343 
1311951478593

How can I convert this to a datetime2 right in the select?

  • 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-06-18T10:59:11+00:00Added an answer on June 18, 2026 at 10:59 am

    Using the formula from @Mikeal Eriksson’s answer here.

    I would convert the float to a bigint and then create the datetime:

    select 
      DATEADD(MILLISECOND, 
              cast(dateModified as bigint) % 1000, 
              DATEADD(SECOND, cast(dateModified as bigint) / 1000, '19700101'))
    from sometable
    

    See SQL Fiddle with Demo

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

Sidebar

Related Questions

Consider the following query: /solr/select?q=linux It returns this XML response: <response> <lst name=responseHeader> <int
Consider the following query in HQL: SELECT m.id, (SELECT (COUNT(*) > 0) FROM SubqueryTable...)
Please consider the following: $query = SELECT legIDs FROM trip; $result = mysql_query($query) or
Consider the following query executed in PostgreSQL 9.1 (or 9.2): SELECT * FROM foo
Please consider the following query: SELECT artist.id, COUNT(DISTINCT artist$styles.v_id) FROM artist LEFT JOIN artist$styles
Consider the following query: SELECT domain, done FROM tasks WHERE 1 GROUP BY domain
Please consider following sample query SELECT * FROM subscriber WHERE subscription_date>DATE(NOW()-INTERVAL 10 DAY) My
Consider the following criteria query: var x = SomeCriteria.AddOrder(new Order(Name, true)).List(); This will order
Consider the following 3 standard statements $queryString = SOME SQL SELECT QUERY; $queryResult =
Consider the following two queries: select a.*, c.* from account a join customer c

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.