I came across the below PeopleCode built-in function when trying to find a way to add a month to %date. So, here it is as PeopleSoft explaines it.
My code ended up being like this :
Suppose, for example, that you want to find a date six years from now. You could not just multiply 6 times 365 and add the result to today’s date, because of leap years. And, depending on the current year, there may be one or two leap years in the next six years. AddToDate takes care of this for you.
You can subtract from dates by passing the function negative numbers.
Considerations Using AddToDate
When you are adding one month to the date provided, and the date provided is the last day of a month, and the next month is shorter, the returned result is the last day of the next month.
For example, in the following, &NewDate is 29/02/2004:
&NewDate = AddToDate("31/01/2004", 0, 1, 0);
When you are adding one month to the date provided, and the date provided is the last day of a month, and the next month is longer, the returned result is not the last day of the next month.
For example, in the following, &NewDate is 29/03/2004.
&NewDate = AddToDate("29/02/2004", 0, 1, 0)
| Title | Under | Posted on |
|---|---|---|
| MD5 - SHA checksum of a file. | PeopleSoft Technical | 02/07/2012 - 5:29am |
| nVision Tabular Report through PIA with prompts | PeopleSoft Technical | 02/02/2012 - 10:07pm |
| Can we create an AE to mass update Position - Jobcode data? | PeopleSoft Technical | 01/18/2012 - 3:11am |
| Pay Components on job data can be defaulted and setup based on the rules? | PeopleSoft Functional | 01/05/2012 - 4:58am |
Comments
i need to change the probation date according to effective date which is in another record.how i can do
If the number of days goes into the next year this does not return the correct date. It assumes a 360 day year.
Have you tried using %DateAdd function.
Find the number of days you wanna add for ex:
%DateDiff(Probation_dt,hire date);
then try using %DateAdd function and let me know whether it helps you.
Post new comment