Skip to main content

Hello. Does anyone know how to use a transformer to change the time? I originally solved it by parsing the data via a string searcher, creating attributes and then compiling. This solution worked. It does not work for this date 20221201000000 (year, month, day, time 2022/12/01/000000 ), where I set the desired -1 second. I get 20221200999999 (2022/12/00/999999) in the output, but it should be 20221130235959 (2022/11/30/235959 ). I need a transformer that doesn't stupidly subtract -1 unit, but works with data like time.

Thank you

Hello @fmesafe.podpora​, thanks for posting! What version of FME Workbench are you using? Also, may I ask what transformer you're using to do the datetime calculation?

 

Have you considered using FME's DateTimeCalculator to subtract the 1 second? With the following parameters, I was able to output 20221130235959 in FME 2022.2.2:

 

imageLet me know if the issue persits! Happy to help, Kailin.


Hi, thanks for your reply, but this solution doesn't work. After this setting, I get the output:

source data: 20221103000000

output data: 20221103000001

It looks like it works with the data as a string and not as a date. Maybe it would help to format the string before entering the datetimecalculator transformer? Another problem is that I need to subtract the second, not add it, but a negative value of "-1" cannot be entered.


Hi, thanks for your reply, but this solution doesn't work. After this setting, I get the output:

source data: 20221103000000

output data: 20221103000001

It looks like it works with the data as a string and not as a date. Maybe it would help to format the string before entering the datetimecalculator transformer? Another problem is that I need to subtract the second, not add it, but a negative value of "-1" cannot be entered.

Hello @fmesafe.podpora​, are you specifying SUBTRACT as the operation type in the transformer? If you're noticing an issue with data types, you can try casting your datetime before running it through a datetime transformer. Would you be able to share a sample workspace and dataset here? Also, what version/build of FME are you currently using? You can find this information in Help > About FME Workbench. Happy to help, Kailin.


Hello @fmesafe.podpora​, are you specifying SUBTRACT as the operation type in the transformer? If you're noticing an issue with data types, you can try casting your datetime before running it through a datetime transformer. Would you be able to share a sample workspace and dataset here? Also, what version/build of FME are you currently using? You can find this information in Help > About FME Workbench. Happy to help, Kailin.

Hi, the workspace is very complicated and data intensive, the problem with time is only a part, unfortunately I can't share. Yes, I have the transformer set correctly, see your post, but the output is wrong, as I wrote above. fme version is FME(R) 2022.1.0.0 (20220704 - Build 22618 - WIN64)

Thank you Kalin


Reply