Date format

Question:
My application (RIS) converts a date in an integer to store it in a Database. Integer = x seconds after 1.1.1970 (for ex., 709444800). I want to make a SQL query that will reconvert this INT into a date format.

Answer:
The only way to do this as a SELECT statement is to embed the math in theSELECT clause and then CAST or otherwise convert the result to date format.

This would be quite unsightly as a query and wouldn’t lend itself well to use in multiple places. If your database supports user-definedfunctions, that would be the best solution. Alternatively, a storedprocedure or trigger could do the conversion for you.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: