Skip to main content

Hi, 

 

I am trying to manipulate the dates based on the logic. 

 

If the effective date falls between 06/01/2025 - 06/31/2025, then the date of inception should be 06/01/2025 and the similar rule applies for the month of july, aug, sept.

And if the effective date is anywhere between 10/01/2025 - 10/01/2026, then the date of inception should be 10/01/2025.

 

The issue here is :

If the effective date is 08/20/2026 → Inception becomes 08/01/2025 ( Expected is 10/01/2025)

The similar issue is observed for months of june, july, aug, sept  for year 2026. 

 

 

           

 

I am surprised here why FME would not pick up the year from the date

There is a comparison mode of Date/Time in the tester but it expects FME format dates.

If you look in the warnings you should see something like 

Tester (TestFactory): TestFactory: Unable to do a date/time comparison of '20/08/2026' and '01/09/2025'.  Comparing as strings instead.

If you just want to create a date of inception as the first day of the month the date falls within, I would do something like this in a DateTimeConverter

 


Definitely look at DateTimeConverter as ​@ebygomm suggested.  Another thing that can help is to store a calendar or date dimension table in a database somewhere (https://www.mssqltips.com/sqlservertip/4054/creating-a-date-dimension-or-calendar-table-in-sql-server/).  That can provide a quick joinable table with month starting dates and various formatted dates  and date components you can use for output.  So instead of having to test for particular date ranges, just join the calendar table to the data stream on the attribute that has the “Effective Date” and grab the “TheFirstOfMonth” column from the calendar table.


Hi ​@aashnaparikh ,

mm/dd/yyyy (e.g. "10/01/2025") is a date format specific to some regions, FME won't consider dates representated by such a regional format as date values. The reason for the issue you observed is that FME compares the dates represented by mm/dd/yyyy as text strings, i.e. "08/20/**** < 08/31/2025" is true regardless what **** (four characters) is.

If you woud like to compare two dates with a comparison operator (<=, =>, etc.), consider formatting the dates by standard FME date format (yyyymmdd, e.g. "20251001") beforehand.


A really helpful approach I use when dealing with datetimes is to convert them to epochs. This then lets you create a point (for a single event) or a line (for a time period) - us a vertexcreator, use the epoch as x  and set y to 0. You can then use spatial operations to compare the various dates