Skip to main content
Solved

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

  • April 18, 2016
  • 3 replies
  • 154 views

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
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.

3 replies

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

The DateFormatter transformer should be able to do this.

Source format is %s, Destination format %T


takashi
Celebrity
  • 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!