Start Free Trial

Alteryx Designer Desktop Discussions

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

Adding decimal hours to start time

Learner_Kat
6 - Meteoroid

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 REPLIES 4
binuacs
21 - Polaris

@Learner_Kat One way of doing this

image.png

flying008
15 - 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
6 - Meteoroid

That works perfect.Thanks much

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

Labels
Top Solution Authors