!!!P2K_SPPERIOD

!Functionality
This database function will convert the date you pass into a period number, for the type of period indicated.


!Parameters
|TYPE          |The type of period you are working with (see below)
|DATE          |The date that you want returned in period format

!Returns:
Number

!Errors
None

!Operation:

This function is intended for use with SPELTOT and SPPCTOT type functions.  Given the date you have specified, this function will return a properly formatted period number, to use with these functions

The format of Calendar period should match the "to-date" type according to the following table.  If, for example, you pass any date in May of 2004, you will get the following results:
||Todate_Type||Looking for                    ||Period
| ‘Y’        | Year To Date for 2004          | 2004
| ‘Q’        | Quarter to date for 2nd Quarter| 200402
| ‘M’        | Month to date for May	      | 200405
	
Example:

{{
p2k_spperiod('Q',~)

P2K_PPAMTS.SPELTOT(EEM_ID,P2K_PPAMTS.SPGETPEL('GROSS'),'Q', p2k_spperiod('Q',~))

}}