Skip to main content
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.
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 🙂
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]

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
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 🙂