• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 705
  • Last Modified:

Converting UNIX TIME in an SQL SELECT statement

I am using FrontPage DRW to select records from an SQL database.  One of the columns is a time stamp in UNIX format (seconds since 01/01/1970 00:00:00).  I want to have my results display the actual time and date.  How can I do this?

As an example:

SELECT DISTINCT
dbo.db.F1,
dbo.db.F2,
dbo.db.F3    <--- contains UNIX TIME values
0
jkalkowski
Asked:
jkalkowski
  • 2
1 Solution
 
muzzy2003Commented:
How about:

SELECT DATEADD(second, UnixTime, CAST('1970-01-01' AS datetime))

;)
0
 
muzzy2003Commented:
Or, in your context:

SELECT DISTINCT
dbo.db.F1,
dbo.db.F2,
DATEADD(second, dbo.db.F3, CAST('1970-01-01' AS datetime))
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now