alteryx Community

# Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

## Time Conversion - Seconds to HH:MM:SS

6 - Meteoroid

Hi,

I want to convert the seconds into 60 seconds into 1 minute i.e, 00:01:00
600 seconds into 10 minute i.e., 00:10:00

Thank you in advance

8 REPLIES 8
17 - Castor

Hi @Anaz_S try this syntax in a formula with your field.

16 - Nebula

Hello @Anaz_S,

is this ok?

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Regards

15 - Aurora

Hi @Anaz_S,

You could use a datetimeadd() function to add the number of seconds and store the value as a time data type.

If this solves your issue please mark the answer as correct, if not let me know!

Regards,

Jonathan

11 - Bolide

One more Solution...

5 - Atom

Hey Jonathan and others, I'm curious if anyone knows why this formula works? Thanks!

11 - Bolide

there isnt really much to explain. the DateTimeAdd function will take a date, and add a value to it. all you need to do is specify the interval that you're adding

DateTimeAdd('1900-01-01', 3600, 'seconds') will add an hour to the base date

DateTimeAdd('1900-01-01', 60, 'minutes') will add an hour to the base date

DateTimeAdd('1900-01-01', 1, 'hours') will add an hour to the base date

DateTimeAdd('1900-01-01', 1, 'days') will add a day to the base date...

you can also subtract

DateTimeAdd('1900-01-01', -1, 'days') will subtract a day from the base date

This means that if you see a timestamp of "1900-01-01 05:00:00", then @Anaz_S will know that they have 5 hours' worth of seconds

In fact, if they're certain that they'll never have more that 24 hours, then they could just save it at a Time field instead of a DateTime field

5 - Atom

Thanks! I was a little confused by the 1900-01-01 date, but I see now that piece is irrelevant.

7 - Meteor

@afv2688 awesome! your solution worked for me. thank you!

Labels