Find a quarter from a date
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 102
- Joined: Tue Jan 31, 2006 4:13 am
Find a quarter from a date
Hi,
I need to find the quarter from the input date '2010-02-01' . The output should be 1 ( which implies the input date falls in 1st quarter)
In server editon, we have Built in-date transform routine like 'QUARTER.TAG . I am unable to find one in PX.
Please let me know.
I need to find the quarter from the input date '2010-02-01' . The output should be 1 ( which implies the input date falls in 1st quarter)
In server editon, we have Built in-date transform routine like 'QUARTER.TAG . I am unable to find one in PX.
Please let me know.
Sujatha K
-
- Premium Member
- Posts: 102
- Joined: Tue Jan 31, 2006 4:13 am
-
- Premium Member
- Posts: 102
- Joined: Tue Jan 31, 2006 4:13 am
-
- Premium Member
- Posts: 102
- Joined: Tue Jan 31, 2006 4:13 am
Sorry - that was a little simplistic, wasn't it?
Code: Select all
INT((MONTH(MonthNum)-1)/3)+1
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You have to do some arithmetic. The first three months you need 1, the second three months you need 2, and so on. Mod(month,3) gives the wrong result, you need something like
If that seems abstruse, go with a functionally equivalent If..Then..Else construct.
Code: Select all
Int(month+(month<>(month-Mod(month,3))/3)
Code: Select all
If Mod(month,3) = 0 Then Int(month/3) Else Int((month + 1)/3)
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.
-
- Premium Member
- Posts: 102
- Joined: Tue Jan 31, 2006 4:13 am