CurrentTimestamp() before 3 months
Moderators: chulett, rschirm, roy
CurrentTimestamp() before 3 months
Objective:
Timestamp value which is 3 months before of CurrentTimestamp().
Please assist...!
Timestamp value which is 3 months before of CurrentTimestamp().
Please assist...!
___________________________________
Regards,
Prabu
Regards,
Prabu
To retain a timestamp value, two possible options come to mind:
1) Use the TimestampFromSecondsSince(). You'll need to calculate the number of seconds that equate to three months (there are 86400 seconds in a day)
2) Get date and time separately--CurrentDate() and CurrentTime(). Then use DateFromDaysSince() to calculate the date 3 months previous to CurrentDate() and create a timestamp from the resulting date and CurrentTime() value.
Regards,
1) Use the TimestampFromSecondsSince(). You'll need to calculate the number of seconds that equate to three months (there are 86400 seconds in a day)
2) Get date and time separately--CurrentDate() and CurrentTime(). Then use DateFromDaysSince() to calculate the date 3 months previous to CurrentDate() and create a timestamp from the resulting date and CurrentTime() value.
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
Or 29 or 28 days (for February).
Ultimately the requirement depends upon the actual business rules (i.e. the client's requirements) for the calculation. They may simply state 90 days previous. Many accounts receivables calculations are based upon 30, 45, 60 and 90 days and not necessarily number of days in the month (although adjustment may be made from time to time).
Regards,
Ultimately the requirement depends upon the actual business rules (i.e. the client's requirements) for the calculation. They may simply state 90 days previous. Many accounts receivables calculations are based upon 30, 45, 60 and 90 days and not necessarily number of days in the month (although adjustment may be made from time to time).
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
CurrentTimestamp() before 3 months
Ray,
My Business rule is to calculate the Timestamp value which is 3 months before current timestamp and NOT on the total number of days (90).
I tried Julian date option which produce result based on total number of days(90) not on the months.
Please advice how to achieve ...!
My Business rule is to calculate the Timestamp value which is 3 months before current timestamp and NOT on the total number of days (90).
I tried Julian date option which produce result based on total number of days(90) not on the months.
Please advice how to achieve ...!
___________________________________
Regards,
Prabu
Regards,
Prabu
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Create a routine that subtracts 3 from the month if it is 4 through 12, or adds 9 to the month and subtracts 1 from the year if the month is 1 through 3, then adjusts the date backwards until it is valid. From that new date, rebuild the timestamp.
Alternately you could perform these steps in stage variables.
Alternately you could perform these steps in stage variables.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.