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
Solved

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

Posted on 2009-05-18
1
211 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
1 Comment
 
LVL 92

Accepted Solution

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

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

837 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