Time for Unix?

More on dates and we're getting a little weird here. Now, Im not sure how widespread the use of UnixTime is in reports but a colleague, Vinod, asked how Publisher could handle unixtime and format it into a readable date.

For those of you that dont know about it, its the number of seconds (not including leap seconds) since midnight UTC January 1st, 1970. I have to admit I have not seen unixtime outside the context of an OS and definitely not used in a report for a date - but hey, it's a requirement.


However, Vinod managed to work it all out based on a blog entry from a while ago on data calculations - 'A Date Addition' heres how he did it.


1183100412 in unix time is actually 29 Jun 2007 in real money ... to get this into your output you would use.

<?xdoxslt:ora_format_date_offset('1970-01-01', MOD_T div 86400, ?+?)?> where MOD_T is the element holding the UNIX time value.

The 86400 gets your seconds to days et voila and that ladies and gentlefolk is unixtime ... done!

Comments:

I just googled ora_format_date_offset and it ONLY came up with entries from this blog and from the BIP forum. Where is this documented and how many other such "secret" functions are there?

Posted by Ron Morton on August 27, 2008 at 06:17 AM MDT #

When using a JDE database and returning a date from a table such as the F4211 transaction date (TRDJ) the date returned is a numeric value such as "105052" which is a JDE form of julian. How can this be formatted to appear as a date.

Posted by Don Eubanks on September 18, 2008 at 01:24 AM MDT #

What if i need to extract time from unix date? The code worked for me was, but now i need to extract time as well, how to do this?

Posted by nikhil on May 31, 2009 at 06:41 PM MDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Follow bipublisher on Twitter Find Us on Facebook BI Publisher Youtube ChannelDiscussion Forum

Join our BI Publisher community to get the most and keep updated with the latest news, How-to, Solutions! Share your feedback and let us hear your voice @bipublisher on Twitter, on our official Facebook page, and Youtube!

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today