Skip to main content

Morning,

I have a list of attributes that I've created with DateTimeConverter in the format %H:%M:%S. However, there is a decimal point at the end with a couple of numbers.

Eg. 08:13:56.236

Does anyone know a way to get rid of everything after and including the decimal point? I've tried attribute splitter and rounder and also @int() and @floor(). But nothing seems to be working

Thanks in advance 🙂

Hi @hayleynicol, a possible way is to use the StringReplacer with these parameters.

  • Mode: Replace Regular Expression
  • Text To Replace \\.\\d*$
  • Replacement Text: <empty>

If you actually want to round, rather than just drop everything after the decimal then if you convert to an FME time then round, then convert back to the format you require that will work


Hi @hayleynicol, a possible way is to use the StringReplacer with these parameters.

  • Mode: Replace Regular Expression
  • Text To Replace \\.\\d*$
  • Replacement Text: <empty>
Awesome, that worked. Was struggling with the 'Text to Replace' field. Thank you

 

 


Hi @hayleynicol,

an alternative to @takashi's solution might be using SubstringExtractor as follows:

Maybe it is a bit easier, because it doesn't require regular expressions. Sometimes they might be a bit tricky;) Please note, that this approach preserves the original attribute and generates a new one with desired result.

"aa" is the name of the attribute you wish to perform operation on (yeah, I wasn't very creative here;)).

 

 


Reply