Solved

Converting integer based (UNIX?) time to and from sql

Posted on 2009-05-18
1
215 Views
Last Modified: 2012-08-14
Basically, I am reading a time value in a database that is being stored in an int data type.

For example 1139678068 is a value in a field called TS_TIME that I have figured out how to convert to '2006-02-11 17:14:28.000' using the formula

DATEADD(s, TS_TIME, '19700101')

Now, I want to write back to the database.  How would I convert getdate() into this integer type of time data using the inverse of the DATEADD function above?

Thanks
0
Comment
Question by:advlgx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 24416933
DATEDIFF(s, '19700101', GETDATE())
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how the fundamental information of how to create a table.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question