Solved

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

Posted on 2009-05-18
1
213 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

738 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