Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Aspiring_Developer
Specialist
Specialist

Sorting of AM /PM tiem format

Hello,

Can anyone please help me with below

I have field "Tstamp" like below:-

Aspiring_Developer_0-1611045685336.png

I want to achieve sorting . 

after 11 PM ,it should takr 12/03/2020 12AM followed by 12/03/2020 01AM.

This field is coming from database directly.

Can anyone please help ?? 

1 Solution

Accepted Solutions
MayilVahanan

Hi @Aspiring_Developer 

Try with Dual function like below

LOAD Dual(CDate, Timestamp(Timestamp#(CDate, 'DD/MM/YYYY hh tt'), 'DD/MM/YYYY HH')) as CDate Inline
[
CDate
12/02/2020 09 PM
12/02/2020 10 PM
12/02/2020 11 PM
12/03/2020 12 AM
12/03/2020 01 AM
12/03/2020 03 AM
];

You can replace CDate with ur date field and instead of inline, u can use directly from SQL

Load *,

Dual(CDate, Timestamp(Timestamp#(CDate, 'DD/MM/YYYY hh tt'), 'DD/MM/YYYY HH')) as CDate

from ursource;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

1 Reply
MayilVahanan

Hi @Aspiring_Developer 

Try with Dual function like below

LOAD Dual(CDate, Timestamp(Timestamp#(CDate, 'DD/MM/YYYY hh tt'), 'DD/MM/YYYY HH')) as CDate Inline
[
CDate
12/02/2020 09 PM
12/02/2020 10 PM
12/02/2020 11 PM
12/03/2020 12 AM
12/03/2020 01 AM
12/03/2020 03 AM
];

You can replace CDate with ur date field and instead of inline, u can use directly from SQL

Load *,

Dual(CDate, Timestamp(Timestamp#(CDate, 'DD/MM/YYYY hh tt'), 'DD/MM/YYYY HH')) as CDate

from ursource;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.