Skip to main content
Solved

How do I convert a number of seconds to a time format


I am extremely new to FME.

In my data-set, I have a column that displays number of seconds . I need this to be in a time format.

Example: column data displays 181, I need this to read 0:03:01.

Any help would be appreciated.

Best answer by takashi

Hi @ryankrawchuk, the DateFormatter could be a quick solution, but it may not work as expected if the timezone of your machine is not set to UTC - Coordinated Universal Time.

If you didn't get your required result from the transformer, try a TclCaller with this Tcl Expression. Assume that an attribute called "_seconds" stores the number of seconds.

clock format [FME_GetAttribute "_seconds"] -format %T -timezone UTC
View original
Did this help you find an answer to your question?

3 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • April 18, 2016

The DateFormatter transformer should be able to do this.

Source format is %s, Destination format %T


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • Best Answer
  • April 19, 2016

Hi @ryankrawchuk, the DateFormatter could be a quick solution, but it may not work as expected if the timezone of your machine is not set to UTC - Coordinated Universal Time.

If you didn't get your required result from the transformer, try a TclCaller with this Tcl Expression. Assume that an attribute called "_seconds" stores the number of seconds.

clock format [FME_GetAttribute "_seconds"] -format %T -timezone UTC

Both of those worked, though Takashi's answer worked with no further issues.

Thanks!


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