Skip to main content
Solved

Date time question FME

  • February 29, 2024
  • 4 replies
  • 175 views

nath
Contributor
Forum|alt.badge.img+6
  • Contributor

Hi, 

I wanted to very simply use a tester to select all records that had a date in the past week. I have tried everything but it does not seem to work.

I have a date field in the correct format, I have also tried other formats via the date/time converter but it does not work. 

@DateTimeNow()-7 does not work.

Anyone have any other suggestions? 

Thx

Nathalie

Best answer by nielsgerrits

nath wrote:

Unfortunately it doesn't work. Am I doing something wrong?

 

 

 

DateTimeNow returns a value as %Y%m%d%H%M%S, for example 20170203170000.1234567

If your Wijzigingsdatum is formatted as %Y%m%d then you have to reformat one or the other.

 

@Left(@DateTimeAdd(@DateTimeNow(),-P7D),8)

Will return 20240223 for today.

View original
Did this help you find an answer to your question?

4 replies

dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • February 29, 2024

The code below will give you 7 days prior to the current date.

@DateTimeAdd(@DateTimeNow(),-P7D)

 


nath
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • March 1, 2024

Unfortunately it doesn't work. Am I doing something wrong?

 

 


nielsgerrits
VIP
Forum|alt.badge.img+54
  • Best Answer
  • March 1, 2024
nath wrote:

Unfortunately it doesn't work. Am I doing something wrong?

 

 

 

DateTimeNow returns a value as %Y%m%d%H%M%S, for example 20170203170000.1234567

If your Wijzigingsdatum is formatted as %Y%m%d then you have to reformat one or the other.

 

@Left(@DateTimeAdd(@DateTimeNow(),-P7D),8)

Will return 20240223 for today.


nath
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • March 1, 2024

That works! thank you very much!

 


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