USERSESSION is our table.
We do:
desc USERSESSION
Name.................................... .. Null? ................ Type
----------------................. .. ---------------- ......... ---------------------
USERID............................... .. NOT NULL ...... VARCHAR2(25)
FIRSTNAME...................... .. ........,,................ VARCHAR2(45)
LASTNAME........................ .. .......................... VARCHAR2(45)
SESSIONCREATIONTIME .. ........................... NUMBER(19)
.....
.......
SESSIONCREATIONTIME is epoch unix timestamp and we want to make it human readable format.
Epoch is calculated from Jan 01, 1970.
We are writing following SELECT statement:
SELECT userid, firstname, lastname, date '1970-01-01'+(1/24/60/60/1000)*sessioncreationtime as sessioncreated FROM usersession;
That's all.
In addition to that, let's say you have exported your data into .csv format. And, you want to display date as in MS Excel spreadsheet.
You open your csv on your excel spreadsheet, let's say column C is your sessioncreationtime and human readable convertion is D:
On D column, you change Format Cells into Date or Time and put formula as
=(C1/86400/1000)+25569
No comments:
Post a Comment