ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Adding decimal hours to start time

Learner_Kat
Meteoroide

Hi All,

I have a column start time 09:00 am(hard coded),and another column with hours of the day I need to create a new  end time which must add hours per  day to 9 :00 am

I tried this DateTimeAdd("2016-03-30 09:00:00",tonumber([Hours per Day]),"hours" ) .  

If [hours per day]  is decimal hours e.g 4.5 then it does not work correctly.

 

Start time   hours per day       end time

9:00            4.5                        13:30

9:00            4.0                        13:00

9:00             2.0                        11:00

 

Any help please.Thanks

4 RESPUESTAS 4
binu_acs
Polaris

@Learner_Kat One way of doing this

image.png

flying008
Aurora

Hi, @Learner_Kat 

 

Any fraction in the duration is truncated. For example, you cannot add "1.5 hours". Instead, add "90 minutes".

 

So, maybe you can use the formula:

 

DateTimeAdd("2016-03-30 09:00:00",tonumber([Hours]) * 60 ,"minutes" )

 

 

录制_2023_08_04_15_35_50_19.gif

or 1 step by formula:

Spoiler
DateTimeFormat(DateTimeAdd("2016-03-30 09:00:00",tonumber([Hours]) * 60 ,"minutes" ),"%H:%M")
Learner_Kat
Meteoroide

That works perfect.Thanks much

flying008
Aurora

Hi, @Learner_Kat 

 

If we can help you get your want, please mark it as a solution and give a like for more share.

Etiquetas
Autores con mayor cantidad de soluciones