Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

convert date time to time with the query record processor

avatar
Contributor

Hey everyone, 

i get a csv file as record from an api call and don't need all columns and want to convert the datetime columns to a time format.

 

For example from 15.09.2022 00:15:00 to 00:15

 

This is my csv record

Interval startInterval stopCamera serial numberCounter namePedestrians coming inPedestrians going out
15.09.2022 00:00:0015.09.2022 00:15:00000000111123400 

 

This is my setting in the Query record Processor

MarioFRS_0-1663243843189.png

Query

 

SELECT 
 #{TodayAxisV2Param}     as "date",
 "Interval start"        as "start time", -- Expected FORMAT(HH:mm)
 "Interval stop"         as "end time",   -- Expected FORMAT(HH:mm)
 "Pedestrians going out" as "out"
FROM FLOWFILE

 

I expect this result for the time fields

 

date start timeend timeout
2022091500:0000:150

 

Does anyone have an idea how I can do this with the Query Record Processor?

1 ACCEPTED SOLUTION

avatar
Contributor

I have found a solution.
I use in the Query Record Processor the sql function substring and  it worked as expected for my case

 

SELECT
SUBSTRING("Interval start", 12, 5) as "start_time"
FROM FLOWFILE

 

 

store_iddatestart_timeend timeout
10052022091500:0000:150

View solution in original post

1 REPLY 1

avatar
Contributor

I have found a solution.
I use in the Query Record Processor the sql function substring and  it worked as expected for my case

 

SELECT
SUBSTRING("Interval start", 12, 5) as "start_time"
FROM FLOWFILE

 

 

store_iddatestart_timeend timeout
10052022091500:0000:150