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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
k526
Contributor
Contributor

HOW TO GET FILEDATE IN TMAP

hi ,

 

how to get filedate. myfilename is pk_20110504124523.csv

i need the date format like this 2011-05-04 12:45:23

 

i tried like this  ((String)globalMap.get("tFileList_2_CURRENT_FILE")).sub string(3,17) .am getting like this 20110504124523.

can any one help me.

Labels (2)
1 Solution

Accepted Solutions
vapukov
Master II
Master II

try this

 

TalendDate.parseDate("yyyyMMddHHmmss",((String)globalMap.get("tFileList_2_CURRENT_FILE")).sub string(3,17)) 

with column type Date and pattern "yyyy-MM-dd HH:mm:ss" it must return proper result

View solution in original post

4 Replies
vapukov
Master II
Master II

try this

 

TalendDate.parseDate("yyyyMMddHHmmss",((String)globalMap.get("tFileList_2_CURRENT_FILE")).sub string(3,17)) 

with column type Date and pattern "yyyy-MM-dd HH:mm:ss" it must return proper result

k526
Contributor
Contributor
Author

Thank you so much this is working fine

vapukov
Master II
Master II


@k526 wrote:
cannot convert from date to string

of course, because - it return Date (see my message)

 

if need string - add one more function formatDate() - it return string

TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",TalendDate.parseDate("yyyyMMddHHmmss",((String)globalMap.get("tFileList_2_CURRENT_FILE")).sub string(3,17)) )
vapukov
Master II
Master II

Welcome! 🙂