CREATE OR REPLACE PACKAGE EFT_NOM.cout_dates IS
/**
-- Purpose : Date calculation routines
-- #version $Revision: 1 $
-- #author $Author: Gilberta $
-- Created : 17/11/2004 10:31:16
*/
/*
$Header: /Isle Of Grain/database/PLSQL/cout_dates.pck 1 7/01/05 12:54 Gilberta $ Logfile, Revision, Date, Author
$Datetime: $ Date and time of last checkin
$Modtime: 4/01/05 16:41 $ Date and time of last modification
$History: cout_dates.pck $
*
* ***************** Version 1 *****************
* User: Gilberta Date: 7/01/05 Time: 12:54
* Created in $/Isle Of Grain/database/PLSQL
* Initial Version
*/
/**
Function to take a gas day (a date expressed without a time component) and
return a date with a time component representing the start of the
gas day with time component.
Note Assumes that a gas day has 24 hours.
#param p_gas_day
#return date representing the start date and time of the given gas day
*/
FUNCTION convert_gas_day_to_date(p_gas_day IN DATE) RETURN DATE;
/**
Function to take a date (expressed with a time component) and
return the gas day on which the date occurs.
Note Assumes that a gas day has 24 hours.
#param p_date date expressed with a time component
#return date (expressed without time component) representing a gas day
*/
FUNCTION convert_date_to_gas_day(p_date IN DATE) RETURN DATE;
/**
-- FUNCTION translate_date --
-- Translate a given date from local timestamp to target timestamp
--
-- %param p_conv_datetime The date to be converted
-- %param p_timeszone_from The timezone we are converting FROM (default g_local_timezone = Europe/Budapest)
-- %param p_timezone_to The timezone we are converting TO (default g_target_timezone = GMT)
--
-- %return A date converted to the target timezone
*/
FUNCTION translate_date ( p_conv_datetime IN DATE
, p_timezone_from IN VARCHAR2 DEFAULT cout_system_configuration.get_configuration_item('G_LOCAL_TIMEZONE')
, p_timezone_to IN VARCHAR2 DEFAULT cout_system_configuration.get_configuration_item('G_TARGET_TIMEZONE') )
RETURN DATE;
/**
-- FUNCTION check_hours_in_gas_day --
-- Returns number of hours for the given gas day
-- Required for Daylight Saving checks where the hours in a day can be 23 or 25
--
-- %param p_gas_day The date being checked (This MUST be provided in local time NOT gmt)
--
-- %return NUMBER. Number of hours in the given gas day
--
-- Note: The gas day given is assumed to be the 6am START of the gas day being checked.
*/
FUNCTION hours_in_gas_day( p_gas_day IN DATE )
RETURN NUMBER;
/**
Function to take a gas day (a date expressed without a time component) and
the number of hours in that day, taking into account any daylight savings in effect.
Note Assumes that a normal gas day has 24 hours.
#param p_gas_day
#return number of hours in the given gas day
*/
FUNCTION get_dst_hours(p_gas_day IN DATE) RETURN NUMBER;
/**
Function to take a gas day (a date expressed without a time component) and produce
an array of the number of hours in that day, taking into account any daylight savings in effect.
Note Assumes that a normal gas day has 24 hours.
#param p_gas_day
#return an array of number of hours in the given gas day
*/
FUNCTION get_hours(p_gas_day IN DATE) RETURN t_int_array;
END cout_dates;
/