Absolute Value and Date Functions

Your rating: None Average: 3.6 (5 votes)

Here is a quick PeopleCode snippet to check the difference between two dates.

&date = Abs(Days365(&yourDate, %Date));

Use the Abs PeopleCode function to return a decimal value equal to the absolute value. This is very useful if you are validating that a date must be within X days before or X days after sysdate.
/* notice since we are using the Abs function, we don't need to code for &date < 90 */
IF &date > 90 Then
   /*your error message*/
End-IF;

The Days365 function returns the number of days between the Date values &yourDate and %Date using a 365-day year.
And finally %Date date function returns a Date value equal to the current server date. This might be different than the client date, returned by %ClientDate

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!

Comments

Have a question? Please ask it on the forum instead.
Rita's picture
Rita (not verified)
Monitoring Records

Hi all,

I want to montior already existing records in HRMS if any new value is added to that records my program should capture that value and it shoud be displayed in online page .Kindly help me with sample code

Thanks in Advance,
Rita

Hari_aindian's picture
User offline. Last seen 5 years 39 weeks ago. Offline
Joined: 08/02/2010
Posts: 84
Re: Monitoring Records

You can track this using the audits.

When ever a field value is added/updated/deleted that will be captured in audit.

So if you query the audit records you will get an idea.

Regards,
Hari.A

Rita's picture
Rita (not verified)
Re: Monitoring Records

Thanks Hari. So that i can query audit table and get relevant values. Is it right?

Thanks and Regards,
Rita

Hari_aindian's picture
User offline. Last seen 5 years 39 weeks ago. Offline
Joined: 08/02/2010
Posts: 84
Re: Absolute Value and Date Functions

Yes. you are right..

Regards,
Hari.A