cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
18560
Views
0
Helpful
3
Replies

SQL statement to convert Epoch time to Human Readable

dolah
Level 1
Level 1

I am looking for the SQL statement that can be used in a query (Query Analyzer) against the CDR database to convert the format from Epoch to MM/DD/YY 00:00:00.

I've googled "Unity Epoch time" (as mentioned on one forum posting) and even asked TAC, but no luck.

Any assistance would be greatly appreciated.

1 Accepted Solution

Accepted Solutions

smallpygmy
Level 1
Level 1

Hi

The statement you are looking for is:

DATEADD(s, dateTimeOrigination, '19700101')

i.e. select DATEADD(s, dateTimeOrigination, '19700101'), duration, callingPartyNumber, originalCalledPartyNumber from callDetailRecord

As a bonus, you can also use

CONVERT(varchar(6),duration/3600)+':'+RIGHT('0'+CONVERT(varchar(2),(duration % 3600)/60),2)+':'+RIGHT('0'+CONVERT(varchar(2),duration%60),2)

to convert the duration from seconds to H:M:S

View solution in original post

3 Replies 3

smallpygmy
Level 1
Level 1

Hi

The statement you are looking for is:

DATEADD(s, dateTimeOrigination, '19700101')

i.e. select DATEADD(s, dateTimeOrigination, '19700101'), duration, callingPartyNumber, originalCalledPartyNumber from callDetailRecord

As a bonus, you can also use

CONVERT(varchar(6),duration/3600)+':'+RIGHT('0'+CONVERT(varchar(2),(duration % 3600)/60),2)+':'+RIGHT('0'+CONVERT(varchar(2),duration%60),2)

to convert the duration from seconds to H:M:S

Thank you, I'll try this today.

Thank you, this resolved my issue.

I used the DATEADD line and was able to print a readable report.

Debbie