46.68 GET_SINCE Function

This function returns the relative date in words (for example, 2 days from now, 30 minutes ago). It also accepts a second optional p_short parameter and returns "in 2d" or "30m" and so forth. This function is equivalent to using the format masks SINCE and SINCE_SHORT available within Oracle APEX and is useful within SQL queries or PL/SQL routines.

Syntax

APEX_UTIL.GET_SINCE (
   p_date  DATE )
   p_short IN [ BOOLEAN DEFAULT FALSE | VARCHAR2 DEFAULT 'N' ] )  
RETURN VARCHAR2;

Parameters

Table 46-58 GET_SINCE Parameters

Parameter Description
p_date The date you want formatted.
p_short Boolean or Y/N to indicate whether to return a short version of relative date.

Example

select application_id, application_name,apex_util.get_since(last_updated_on) last_update 
  from apex_applications 
 order by application_id 

Syntax

APEX_UTIL.GET_SINCE (
   p_value in [ timestamp | timestamp with time zone | timestamp with local time zone ],
   p_short in [ boolean default false | varchar2 default 'N' ] )
RETURN VARCHAR2; 

Parameters

Parameter Description
p_value The TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE you want to format.
p_short Boolean or Y/N to indicate whether to return a short version of relative date.

Examples

This example returns the LAST_UPDATE column with the normal formatting.

select application_id, application_name, apex_util.get_since( last_updated_on ) last_update
  from apex_applications
 order by application_id;

This example returns the LAST_UPDATE column with the short formatting.

select application_id, application_name, apex_util.get_since( last_updated_on, p_short => 'Y' ) last_update
  from apex_applications
 order by application_id