We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

how to add hour in HH format

shahnawaz_khan
8 - Asteroid

hi,

 

I have attached the input and also the output which I required.

 

from input 07:00:00 to output 7

 

 

InputOutput
00:00:000
01:00:001
02:00:002
03:00:003
04:00:004
05:00:005
06:00:006
07:00:007
3 REPLIES 3
shahnawaz_khan
8 - Asteroid

attaching data

davidskaife
14 - Magnetar

Hi @shahnawaz_khan 

 

DateTimeFormat formula will do it:

 

Capture.PNG

 

Use %k instead of %H if you want to have the output as one digit (0, 1, 2 etc) but it adds a space before so will need tidying up

aatalai
15 - Aurora

I would say @davidskaife is the most efficient; if you want to avoid using the datetime functions then something like this will also work

 

IIF( left(left(ToString([Input]),2),1)="0", right(left(ToString([Input]),2),1),left(ToString([Input]),2))

Labels
Top Solution Authors