Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
kmswetha
Creator
Creator

Timestamp format error

I'm having a file name where I should be extracting timestamp from the file.

However I'm able to convert to date but not time stamp

My file format is XYZ_20_11_2016_00_12

by using string functions I'm able to extract date, 11/20/2016 but its throwing error for time stamp.

I'm using date(date#)) but it is not working for timestamp(timestamp#))

any suggestions

1 Solution

Accepted Solutions
kmswetha
Creator
Creator
Author

surprise part is, if I hardcode and do its working

=timestamp(timestamp#(right('XYZ_20_11_2016_00_12',16),'DD_MM_YYYY_HH_MM'),'M/D/YYYY HH:MM:SS tt')

but not if I replace file name (

View solution in original post

13 Replies
kusumanchir
Creator
Creator

Hi Swe,

Please try using this,

=timestamp(timestamp#(replace(mid('XYZ_20_11_2016_00_12',5,10),'_','/')&' ' & replace(mid('XYZ_20_11_2016_00_12',16,5),'_',':'),'DD/MM/YYYY hh:mm'))

tresesco
MVP
MVP

How are you using timestamp(Timestamp#(... ; what is it giving you as output and what do you expect?

kmswetha
Creator
Creator
Author

it's not giving anything.In textbox it's just showing -

Miguel_Angel_Baeyens

Which expression are you using and what format code are you providing?

PrashantSangle

Try simple

=Timestamp(Timestamp#(mid('XYZ_20_11_2016_00_12',index('XYZ_20_11_2016_00_12','_')+1),'DD_MM_YYYY_hh_mm'))

Replace XYZ_20_11_2016_00_12 with your fieldName.

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 🙂
Anil_Babu_Samineni

Try this, May be?

=Date(Date#(Purgechar(Left(Replace(KeepChar('XYZ_20_11_2016_00_12', '0123456789_'),'_', '/'),11),'/'),'DDMMYYYY'),'MM/DD/YYYY')

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

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)
tomasz_tru
Specialist
Specialist

If the string is the same lenght all the time:

timestamp(timestamp#(right(FIELD,16), 'DD_MM_YYYY_HH_MM'),'YYYY-MM-DD HH:MM:SS') as ts

kmswetha
Creator
Creator
Author

surprise part is, if I hardcode and do its working

=timestamp(timestamp#(right('XYZ_20_11_2016_00_12',16),'DD_MM_YYYY_HH_MM'),'M/D/YYYY HH:MM:SS tt')

but not if I replace file name (

kmswetha
Creator
Creator
Author

I did exactly same, it works but if replace FIELD with actual name its not working