Alteryx Designer Discussions

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

Hours to datetime

DADE
7 - Meteor

Hello,

 

I have 8760 rows per year and I would like to convert them to datetimeformat in Alteryx (taking into account daylight savings time). Is there any way to do this?

 

hour of the yearyearWhat I want

1

20202020-01-01 00:00:00
2

2020

2020-01-01 01:00:00

320202020-01-01 02:00:00
420202020-01-01 03:00:00
520202020-01-01 04:00:00
620202020-01-01 05:00:00
720202020-01-01 06:00:00
820202020-01-01 07:00:00
920202020-01-01 08:00:00
10 20202020-01-01 09:00:00
1120202020-01-01 10:00:00
1220202020-01-01 11:00:00
1320202020-01-01 12:00:00
1420202020-01-01 13:00:00
1520202020-01-01 14:00:00
1620202020-01-01 15:00:00
1720202020-01-01 16:00:00
1820202020-01-01 17:00:00
1920202020-01-01 18:00:00
2020202020-01-01 19:00:00
2120202020-01-01 20:00:00
2220202020-01-01 21:00:00
2320202020-01-01 22:00:00
2420202020-01-01 23:00:00
2520202020-01-02 00:00:00
2620202020-01-02 01:00:00
2720202020-01-02 02:00:00
...2020...
8760

2020

2020-12-31 23:00:00

 

1 REPLY 1
Hannah_Lissaman
11 - Bolide

Hi @DADE 

 

This is a perfect use for the Generate Rows tool. You can use this to generate all hours in a year from scratch. 

 

For the daylight savings part of your request, you will need to add the start and end times of daylight savings as an input. You can then use a Formula tool with an if statement to check whether a date falls within the period, and add 1 hour if it does.

 

Hannah_Lissaman_0-1590082761800.png

 

I have attached my workflow for you.

Labels