Link to home
Start Free TrialLog in
Avatar of kvilimas
kvilimas

asked on

how to extract trimester out of date field

There are standard functions to get year, quarter, month, etc out of date field ( DATEPART functions). In Norway though we use often trimesters (i.e. 4 month periodes, 3 in one year). Does anyone have an idea/function to extract that out of date?
SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of StealthyDev
StealthyDev

You can also use

((MONTH(MyDateField)-1) / 4) + 1

in your query.


Regards.
Avatar of kvilimas

ASKER

Hi senthurpandian. Is there something missing in your function? Truncation or something?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I would suggest to accept #30589065 as a solution,
I would suggest that your solution is only effective as long as one remembers the formula:  (MONTH(MyDateField )-1) / 4) + 1.  I contend that putting the logic into a user-defined function is more extensible.