Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld 2023, a live, in-person thrill ride. April 17 - 20, 2023, in Las Vegas! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
EliGohar
Partner - Creator III
Partner - Creator III

Remove seconds from timestamp fields

Hi

I'm trying to remove the seconds part in my timestamps fields and of course keeping this fields in timestamp format.

I tried the following:

TEMP:
LOAD
	SourceID,
	ObjectID,
    [Start Time],
Timestamp(timestamp#(left([Start Time], 16), 'MM.DD.YYYY hh:mm')) as 'Start Time Test',
    [End Time],
Timestamp(timestamp#(left([End Time], 16), 'MM.DD.YYYY hh:mm')) as 'End Time Test'
Inline [
SourceID, ObjectID, Start Time, End Time
1, 12345, 28/02/2019 16:00:50, 28/02/2019 16:05:00
2, 67890, 01/03/2019 23:59:45, 02/03/2019 0:02:20
];

and can't get it to work :

21.png

please tell me how can I overcome it.

Thanks!

Eli

Labels (1)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

With expression:

Date(Date#([Start Time], 'DD/MM/YYYY hh:mm:ss'), 'DD/MM/YYYY hh:mm') as [Start Time Test]

you are not actually removing the seconds from the timestamp, but hiding them. That way, your app size would not reduce, if you don't need this seconds details in UI, you should remove them using floor() as I showed above. Try:

Date(Floor(Date#([Start Time],'DD/MM/YYYY hh:mm:ss'),1/24/60),'DD/MM/YYYY hh:mm')
as [Start Time Test]

 

View solution in original post

6 Replies
PrashantSangle

TEMP:
LOAD
SourceID,
ObjectID,
[Start Time],
Timestamp(timestamp#(left([Start Time], 16), 'MM/DD/YYYY hh:mm:ss'),'MM/DD/YYYY hh:mm') as 'Start Time Test',
[End Time],
Timestamp(timestamp#(left([End Time], 16), 'MM/DD/YYYY hh:mm:ss'),'MM/DD/YYYY hh:mm') as 'End Time Test'
Inline [
SourceID, ObjectID, Start Time, End Time
1, 12345, 28/02/2019 16:00:50, 28/02/2019 16:05:00
2, 67890, 01/03/2019 23:59:45, 02/03/2019 0:02:20
];


regards,
Prashant
Great dreamer's dreams never fulfilled, they are always transcended.
Anil_Babu_Samineni

Perhaps this way?

Date(Date#([Start Time], 'DD/MM/YYYY hh:mm:ss'), 'DD/MM/YYYY hh:mm') as [Start Time Test]

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
tresesco
MVP
MVP

For removing seconds from timestamp, you should use floor() with step, like:

Timestamp(Floor([Start Time],1/24/60)) as as TimeWithoutSec 
EliGohar
Partner - Creator III
Partner - Creator III
Author

It works for me, many thanks @Anil_Babu_Samineni
tresesco
MVP
MVP

With expression:

Date(Date#([Start Time], 'DD/MM/YYYY hh:mm:ss'), 'DD/MM/YYYY hh:mm') as [Start Time Test]

you are not actually removing the seconds from the timestamp, but hiding them. That way, your app size would not reduce, if you don't need this seconds details in UI, you should remove them using floor() as I showed above. Try:

Date(Floor(Date#([Start Time],'DD/MM/YYYY hh:mm:ss'),1/24/60),'DD/MM/YYYY hh:mm')
as [Start Time Test]

 

EliGohar
Partner - Creator III
Partner - Creator III
Author

@tresesco 

Thank you, now it's more clear, i didn't know about the differences 🙂