About 1,550,000 results
Open links in new tab
  1. sql - Convert bigint to datetime - Stack Overflow

    Sep 6, 2010 · To convert bigint to datetime/unixtime, you must divide these values by 1000000 (10e6) before casting to a timestamp. SELECT CAST( bigIntTime_column / 1000000 AS timestamp) example_date FROM example_table

  2. How can I convert bigint (UNIX timestamp) to datetime in SQL

    May 25, 2010 · Arithmetic overflow error converting expression to data type int. due to unix timestamp is in bigint (instead of int), you can use this: SELECT DATEADD(S, CONVERT(int,LEFT(1462924862735870900, 10)), '1970-01-01') FROM TABLE Replace the hardcoded timestamp for your actual column with unix-timestamp

  3. SQL Server CONVERT() Function - W3Schools

    The CONVERT () function converts a value (of any type) into a specified datatype. Tip: Also look at the CAST () function. Required. The datatype to convert expression to.

  4. SQL Server: Convert to DateTime from other Datatypes

    Nov 12, 2014 · Method 1 : Big Integer to Datetime. Assume that the date value along with time part is stored in Bigint datatype, use this query . Here’s the same query for you to try out: declare @date bigint set @date=20101219201119 . select cast(left(date,8)+' '+stuff(stuff(substring(date,9,6),5,0,':'),3,0,':') as datetime) from

  5. SQL Convert Examples for Dates, Integers, Strings and more

    May 28, 2024 · So far, we’ve seen how to convert date data types (date, smalldatetime, etc.), and optionally convert the output format, as well as convert integers, bigint, decimals and numeric data types. The following are links to more tips and tutorials on …

  6. Convert Bigint to Datetime SQL Server - Stack Overflow

    Feb 28, 2019 · I want to combine data from each table, but I want the bigint converted into a datetime. I tried SELECT DATEADD(DD, convert(bigint, Report_Date), Report_date) however I get the error message: Arithmetic overflow error converting expression to data type datetime.

  7. Convert specific BigInt to DateTime in T-SQL - Stack Overflow

    I have bigInt: 635307578922100000 which I need to convert to DateTime. I've tried few ways to do this: SELECT DATEADD(S, CONVERT(bigint,635307578922100000) / 1000, CONVERT(DATETIME, '1-1-1970 00:00:00'))

  8. sql server - How to Cast today data as bigint to Data

    Apr 17, 2021 · First use CAST() to convert it to a string representing that same value; Then construct a new string my using SUBSTRING() to pull out the parts and add punctuation as needed, i.e. SUBSTRING(@TimestampIntAsString, 1, 4) to pull out the year, so you end up with '2021-04-17 18:30'

  9. Convert Bigint time to datetimeSQLServerCentral Forums

    Apr 17, 2014 · SELECT DATEADD(hh,-5,dateadd(s, convert(bigint, 1397750400000) / 1000, convert(datetime, '1-1-1970 00:00:00'))) worked for me!

  10. SQL Date Format Examples using CONVERT Function

    Learn SQL date format options with the SQL CONVERT function when working with date data types in SQL Server.

Refresh