Skip to main content
Solved

Date time question FME

  • February 29, 2024
  • 4 replies
  • 231 views

nath
Contributor
Forum|alt.badge.img+7

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

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

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+7
  • Author
  • Contributor
  • March 1, 2024

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

 

 


nielsgerrits
VIP
Forum|alt.badge.img+62
  • Best Answer
  • March 1, 2024

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+7
  • Author
  • Contributor
  • March 1, 2024

That works! thank you very much!