Package date_util_pkg

Variables, constants

const g_date_fmt_date

g_date_fmt_date constant varchar2(30):='dd.mm.yyyy'

const g_date_fmt_date_hour_min

g_date_fmt_date_hour_min constant varchar2(30):='dd.mm.yyyy hh24:mi'

const g_date_fmt_date_hour_min_sec

g_date_fmt_date_hour_min_sec constant varchar2(30):='dd.mm.yyyy hh24:mi:ss'

const g_months_in_quarter

g_months_in_quarter constant number:=3

const g_months_in_year

g_months_in_year constant number:=12

Functions, procedures

function get_year

function get_year(
    p_date in date
) return number

return year based on date

function get_month

function get_month(
    p_date in date
) return number

return month based on date

function get_start_date_year

function get_start_date_year(
    p_date in date
) return date

return start date of year based on date

function get_start_date_year

function get_start_date_year(
    p_year in number
) return date

return start date of year

function get_end_date_year

function get_end_date_year(
    p_date in date
) return date

return end date of year based on date

function get_end_date_year

function get_end_date_year(
    p_year in number
) return date

return end date of year

function get_start_date_month

function get_start_date_month(
    p_date in date
) return date

return start date of month based on date

function get_start_date_month

function get_start_date_month(
    p_year in number,
    p_month in number
) return date

return start date of month

function get_end_date_month

function get_end_date_month(
    p_date in date
) return date

return end date of month based on date

function get_end_date_month

function get_end_date_month(
    p_year in number,
    p_month in number
) return date

return end date of month

function get_days_in_month

function get_days_in_month(
    p_year in number,
    p_month in number
) return number

return number of days in given month

function get_days_in_period

function get_days_in_period(
    p_from_date_1 in date,
    p_to_date_1 in date,
    p_from_date_2 in date,
    p_to_date_2 in date
) return number

return number of days in one period that fall within another period

function is_period_in_range

function is_period_in_range(
    p_year in number,
    p_month in number,
    p_from_year in number,
    p_from_month in number,
    p_to_year in number,
    p_to_month in number
) return boolean

returns true if period falls within range

function get_quarter

function get_quarter(
    p_month in number
) return number

get quarter based on month

function fmt_time

function fmt_time(
    p_days in number
) return varchar2

get time formatted as days, hours, minutes, seconds

function fmt_time

function fmt_time(
    p_from_date in date,
    p_to_date in date
) return varchar2

get time between two dates formatted as days, hours, minutes, seconds

function fmt_date

function fmt_date(
    p_date in date
) return varchar2

get date formatted as date

function fmt_datetime

function fmt_datetime(
    p_date in date
) return varchar2

get date formatted as date and time

function get_days_in_year

function get_days_in_year(
    p_year in number
) return number

get number of days in year

function explode_month

function explode_month(
    p_year in number,
    p_month in number
) return t_period_date_tab

returns collection of dates in specified month

function get_date_tab

function get_date_tab(
    p_calendar_string in varchar2,
    p_from_date in date:=null,
    p_to_date in date:=null
) return t_date_array

get table of dates based on specified calendar string

Types

record t_period_date

type t_period_date is record(
    year number,
    month number,
    day number,
    days_in_month number,
    the_date date
)

varray t_period_date_tab

type t_period_date_tab is varray of t_period_date