-1

I am having a date column in string format, but I want to change that string into date format using with tmap in Talend. Now could you please tell me which expression I need to use to change the format from string to date.

GadaaDhaariGeek
  • 971
  • 1
  • 14
  • 33
Naresh AR
  • 69
  • 2
  • 12

1 Answers1

0

You can use the in-built Talend Java routines for this purpose in a tMap.

Here is an example:

TalendDate.parseDate("yyyy-MM-dd", row1.dateStr)

enter image description here

enter image description here

gil.fernandes
  • 12,978
  • 5
  • 63
  • 76
  • TalendDate.Format("yyyy-MM-dd HH:mm:ss",TalendDate.parsedate("MM/dd/yy",column) – Naresh AR Oct 03 '17 at 18:09
  • 1
    This expression will convert from string in one format to string in another format. As I understood your question you wanted to convert from "string" to "date". – gil.fernandes Oct 03 '17 at 18:12
  • Hi, I want to do something similar I am having timestamp as string I want to convert it into date timestamp but I am getting two exceptions 1- : String index out of range: 13 and 2 - Unparseable date: "1631898440" – Amara Dec 07 '21 at 07:31
  • @CS. Perhaps you need to convert the numeric timestamp to a date object first (e.g `new Date(Long.parseLong("1631898440"))`) and then use something like `TalendDate.Format("yyyy-MM-dd HH:mm:ss",TalendDate.parsedate("MM/dd/yy",column)` – gil.fernandes Dec 07 '21 at 08:39