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.

  1. Formula for Yr

  2. MOD(YEAR(PERIODSTRT),10)

  3. 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.



 
 

Disclaimer:
The information provided in the list of Knowledge-Base Articles are provided on an As-Is basis without warranty of any kind, either expressed or implied, including warranties of merchantability and fitness for a particular purpose. In noevents shall FACT Software International Pte Ltd or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if FACT Software International Pte Ltd or its suppliers have been advised of the possibility of such damages. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. All third party trademarks are the property of their respective owners.

Copyright © 2010 FACT Software International Pte Ltd