Skip to main content
Question

How do I identify features with a date from the current month and / or current quarter?

  • December 21, 2023
  • 2 replies
  • 140 views

stu_home
Contributor
Forum|alt.badge.img+5

Quarter 1 is April, May and June; Q2 = July, Aug, Sept; Q3 = Oct, Nov, Dec; and Q4 as Jan, Feb, March.

If I need to run a workbench at regular intervals throughout the year, which transformers will I need to identify features from the current month, and current quarter?

I have converted the dates to FME format, and I guess I need to add a DateTimeStamper to get the current date. Then what do I need to do?

Many thanks in advance for any pointers you can give me.

Regards

Stu

2 replies

ctredinnick
Supporter
Forum|alt.badge.img+18
  • Supporter
  • December 21, 2023

A DateTimeStamper will give you a number that represents the current date, but you can also use string functions to pick characters out of it. In an AttributeCreator, create Month = @Substring(@Value(_timestamp),4,2)

And from that create a Quarter attribute with a conditional statement, if Month In 04,05,06, then Quarter 1, if Month in 07,08,09 then Quarter 2 etc.


geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • December 21, 2023

You can also calculate the quarter from the month, for example with something like this:

@fmod(@ceil(@Value(Month)/3)+2,4)+1

Be careful you do not inadvertently process months or quarters of a wrong year. Maybe add the year to month and quarter, e.g. 2023-Q3.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings