Posts

Showing posts with the label function

Times at specific time zones

These past couple of weeks, I have been doing some work with some external APIs, so have had to do some time stamp manipulation. Here are some tips I've learnt along the way. A quick way to get UTC time, is with the function: sys_extract_utc . With that, we can quickly get the UTC timestamp. Here is an example to return the UTC time in RFC3399/ISO8601 format: to_char( sys_extract_utc(systimestamp) , 'yyyy-mm-dd"T"hh24:mi:ss.ff3"Z"' ) To return that back into local time, you want to declare a variable with time zone support. So just say the string you have is: 2014-04-17T02:46:16.607Z, you'll want to declare it with a time zone attribute. l_time timestamp with time zone; Since Z refers +00:00, you need to set the time zone. If you call to_timezone or to_timezone_tz , without specifying the timezone, it will create the time in the local time zone, so we need to specifically set it with from_tz . Either: l_time := to_timestamp_t...

Error Handling API

Originally heard about this from Patrick's blog months back. See  http://www.inside-oracle-apex.com/apex-4-1-error-handling-improvements-part-1/  and  http://www.inside-oracle-apex.com/apex-4-1-error-handling-improvements-part-2/ . Then a couple of weeks back I was looking at the new features on the Apex builder guide, where they mention about the enhanced error handling. See  http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/what_new.htm#CEGIEDHE . So I thought I may as well set up a basic example to see how it is. The only sections in the documentation that really talk about it are: Application Definition Page Definition Which is basically about setting the error handling (PL/SQL) function. The main source of information is on the API docs for apex_error . This page talks about data types, and available functions/procedures you can use with this package, which will allow customising the displayed error message. Whilst the API docs do provide a goo...