Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
PaulK
Contributor III
Contributor III

Create a new column with 5 minute time intervals from a date and time field

Hi

I have a column (Date_Time) in a csv file which has a date and time entered in the following format 2022-05-17 15:48:34. I'm trying to split the time into 5 minute intervals and create a new column with the time in 5 minute intervals and the date removed. In the data load editor I've used the following line 

Timestamp(floor([Date_Time],5/(24*60)))         as [Time_5min]

However this then displays the date and time in 5 minute intervals as below

Date_Time Time_5min
17/05/2022 15:48 17/05/2022 15:45:00 
2022-06-30 09:38:53 30/06/2022 9:35:00 
2022-06-30 09:42:29 30/06/2022 9:40:00 
2022-07-01 07:28:35 01/07/2022 7:25:00 
2022-07-01 07:34:56 01/07/2022 7:30:00 
2022-07-01 07:35:36 01/07/2022 7:35:00 
2022-07-01 07:56:28 01/07/2022 7:55:00 
2022-07-01 07:56:33 01/07/2022 7:55:00 
2022-07-01 07:56:35 01/07/2022 7:55:00 

 

Is it possible to remove the date so just the time is entered into the new column (Time_5Min), the same as the table below?

Date_Time Time_5min
17/05/2022 15:48 15:45:00
2022-06-30 09:38:53 9:35:00 
2022-06-30 09:42:29 9:40:00 
2022-07-01 07:28:35 7:25:00 
2022-07-01 07:34:56 7:30:00 
2022-07-01 07:35:36 7:35:00 
2022-07-01 07:56:28 7:55:00 
2022-07-01 07:56:33 7:55:00 
2022-07-01 07:56:35 7:55:00 

 

Any help would be much appreciated.

Thanks
Paul

 

Labels (2)
1 Solution

Accepted Solutions
PrashantSangle

yes.

 

try below

Time(Frac(floor([Date_Time],5/(24*60)))) as time,

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

4 Replies
PrashantSangle

Hi, 

try below

Time(Frac(Time_5min)) as time;

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
PaulK
Contributor III
Contributor III
Author

Hi

Thank you @PrashantSangle  for your response.

Is it possible to include the expression to split the date and time into my original expression which splits the time into 5 minute intervals?
Timestamp(floor([Date_Time],5/(24*60)))         as [Time_5min]

The Time_5min column is only created once the load editor has run and it would be easier to create the Time_5min column using one expression if possible.

Thanks
Paul

PrashantSangle

yes.

 

try below

Time(Frac(floor([Date_Time],5/(24*60)))) as time,

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
PaulK
Contributor III
Contributor III
Author

Thank you @PrashantSangle  Time(Frac(floor([Date_Time],5/(24*60)))) as time,     worked and split the time out into the new Time-5min column.

Thanks for your help
Paul