|
|
Implementing
short format dates in PERKS
|
|
Article
No |
Q0005 |
|
Version Applicability |
PERKS
2.45
and later |
|
Last Reviewed On |
May
15, 2000 |
SYMPTOM You are no
longer scared about the Y2K issue. You already know that PERKS encourages and internally
maintains all the dates in long format. Notwithstanding, you want to get the Year portion
of a date in short format. As an instance, consider any date type variable, such as the
Period Start Date. Suppose it is 01-01-2001, so you want a corresponding numeric value,
which will be the short form of the Year portion in this case 1 or
01. You created a Head of Pay (HOP) using a formula like:
"YEAR(PERIODSTRT)". However, this returns the Year portion in long date format,
including the century as well, - whereas a short form was only desired.
RESOLUTION
While we still need to use the
YEAR() function, the System offers a handy function named MOD()
that can help us to meet this requirement.
Specify the formula as:
MOD(YEAR(PERIODSTRT),100)
The above formula is sufficient to meet your need as stated above.
However, being a number, this formula will return the Year portion for the
Year 2001. In this case, the value, which the System is ought to return, is
1 (and not 01). If you desire to trap the Decimal and Unit
portions separately (i.e., 0 and 1), then you will need two
HOPs.
Let us refer them as Dec and Yr respectively. Here is how you can
proceed.
-
Formula for Yr
MOD(YEAR(PERIODSTRT),10)
-
Formula for Dec
INT((MOD(YEAR(PERIODSTRT),100)-MOD(YEAR(PERIODSTRT),10))/10)
Once you have defined HOPs that return the desired figures, you can use
them in Reports.
MORE INFORMATION
For more information, please search
the Online Help for Mathematical Functions or Formula Builder from
the Find tab.
|
|