42.67 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", "30m". This function is equivalent to using the SINCE and SINCE_SHORT format mask available within Oracle Application Express 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 42-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 formatted.

p_short

Boolean or ‘Y’ / ’N’ to indicate whether to return a short version of relative date.

Example

This 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 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