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: 
lcupito
Contributor
Contributor

Problem with PARSE DATE

Hi everyone,

I have a problem to parse a date from millisecond to 'YYYY-MM-DD hh:mm. From tFileProperties i get mtime and i bring it into tmap. How can i trasform this time 1694694720000 into date format YYYY-MM-DD hh:mm? I have mtime_string too but it return Thu Sep 14 14:32:00 CEST 2023 and i can't trasform in my format date. Someone can help me?

thank you

0695b00000of31sAAA.png

Labels (4)
1 Solution

Accepted Solutions
Fabio_Caimi
Contributor II
Contributor II

Hi lcupito,

you can easily get:

  • a Date variable from mtime (in this case remember to set the date pattern in the output schema)
  • or a String variable from mtime_string.

 

Depending on what you need, try creating one of these 2 variables in your tMap:

 

  • myDate -> new java.util.Date((long)(row1.mtime*1000)/1000) 
  • myString -> TalendDate.formatDate("yyyy-MM-dd HH:mm",TalendDate.parseDate("EEE MMM dd HH:mm:ss zzz yyyy",row3.mtime_string)) 

 

0695b00000of4L0AAI.jpg 

0695b00000of4LFAAY.jpg 

Regards,

Fabio

View solution in original post

1 Reply
Fabio_Caimi
Contributor II
Contributor II

Hi lcupito,

you can easily get:

  • a Date variable from mtime (in this case remember to set the date pattern in the output schema)
  • or a String variable from mtime_string.

 

Depending on what you need, try creating one of these 2 variables in your tMap:

 

  • myDate -> new java.util.Date((long)(row1.mtime*1000)/1000) 
  • myString -> TalendDate.formatDate("yyyy-MM-dd HH:mm",TalendDate.parseDate("EEE MMM dd HH:mm:ss zzz yyyy",row3.mtime_string)) 

 

0695b00000of4L0AAI.jpg 

0695b00000of4LFAAY.jpg 

Regards,

Fabio