Forum

Creating a date tab...
 
Notifications
Clear all

Creating a date table with 24 hours for each date

6 Posts
2 Users
0 Reactions
64 Views
(@bearco)
Posts: 4
Active Member
Topic starter
 

Your technique using the list function to automatically add dates to today's date is terrific. I have a need to do that and to add 24 hours to each date. How can I do that?

 

Larry

 
Posted : 31/05/2019 4:35 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Larry,

With the List.DateTime function:

e.g.

= List.DateTimes(#datetime(2019, 01, 01, 00, 00, 0), 744, #duration(0, 1, 0, 0))

Will give you 1 hour for every day in January 2019 i.e. 31 days x 24 hours = 744 records.

 

Mynda

 
Posted : 31/05/2019 7:28 pm
(@bearco)
Posts: 4
Active Member
Topic starter
 

How does that fit into this formula?

List.Dates(#date(2018,1,1), Duration.Days(DateTime.Date(DateTime.FixedLocalNow())-#date(2018,1,1)), #duration(1,0,0,0))

does this do the what I want?

= List.DateTimes(#datetime(2018, 01, 01, 00, 00, 0), Duration.Days(DateTime.Date(DateTime.FixedLocalNow())-#date(2018,1,1)), #duration(1, 1, 0, 0))

When I tried this, it looked like it gave me date/time numbers or the am/pm times. 

 

Thanks for the help.

 
Posted : 02/06/2019 8:21 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Larry,

I think you want this (see changes in red):

= List.DateTimes(#datetime(2018, 01, 01, 00, 00, 0), Duration.Days(DateTime.Date(DateTime.FixedLocalNow())-#date(2018,1,1))*24, #duration(0, 1, 0, 0))

This will give you 24 records for each date with a 1 hour increment.

Mynda

 
Posted : 03/06/2019 6:15 am
(@bearco)
Posts: 4
Active Member
Topic starter
 

That gave me 24 rows for each date, but didn't increment the hours. All were 12:00 AM.

 
Posted : 04/06/2019 1:56 pm
(@bearco)
Posts: 4
Active Member
Topic starter
 

I spoke too soon. That did give me what I wanted. Thank you very much. I must remember to get the computer some time to finish calculating changes -:)

 
Posted : 04/06/2019 2:01 pm
Share: