Q
Problem solve Get help with specific problems with your technologies, process and projects.

Number of seconds since a certain date in Oracle

Is there any way to convert sysdate to the number of seconds since Jan 01, 1970?

Here, we simply subtract our specific date from Oracle's SYSDATE to find the number of days between the two dates. There are 24 hours in a day, 60 minutes in an hour, and 60 seconds in a minute, and so to find the number of seconds, we multiply the number of days by the product of these three numbers. Here's the SQL:

select (sysdate - cast('01-JAN-1970' as date)) * 86400 
  from dual;

For More Information

  • What do you think about this answer? E-mail the edtiors at editor@searchDatabase.com with your feedback.
  • The Best SQL Web Links: tips, tutorials, scripts, and more.
  • Have an SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
  • Ask your technical SQL questions -- or help out your peers by answering them -- in our live discussion forums.
  • Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.

Dig Deeper on Oracle and SQL

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close