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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

no timestamp data type in talend?

-
It converts it into date types .......... or is there any date pattern like - yyyy-mm-dd hh:mm:ss
Labels (2)
19 Replies
Anonymous
Not applicable
Author

I also want to know an answer to it please.
Anonymous
Not applicable
Author

the Date type can be formatted however you want, by using
TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",context.myDate)

personally, if I want just the date or time of a context variable with the type Date, I do this:
TalendDate.parseDate("yyyy-MM-dd",TalendDate.formatDate("yyyy-MM-dd",context.myDate))
TalendDate.parseDate("HH:mm:ss",TalendDate.formatDate("HH:mm:ss",context.myDate))

http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
Anonymous
Not applicable
Author

amm and is the same as the timestamp format ?
Anonymous
Not applicable
Author

yea, if you don't format the date it will come out in this format:
EEE MMM dd HH:mm:ss zzz yyyy

example:
context.myDate = TalendDate.getCurrentDate();
System.out.println(context.myDate);
System.out.println();
System.out.println(TalendDate.formatDate("EEE MMM dd HH:mm:ss zzz yyyy",context.myDate));
System.out.println(TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",context.myDate));
System.out.println(TalendDate.formatDate("yyyy-MM-dd",context.myDate));
System.out.println(TalendDate.formatDate("HH:mm:ss",context.myDate));
System.out.println();
System.out.println(TalendDate.parseDate("yyyy-MM-dd",TalendDate.formatDate("yyyy-MM-dd",context.myDate)));
System.out.println(TalendDate.parseDate("HH:mm:ss",TalendDate.formatDate("HH:mm:ss",context.myDate)));

outputs these results:
Starting job tFileList_filter at 12:41 05/11/2008.
Wed Nov 05 12:41:07 EST 2008
Wed Nov 05 12:41:07 EST 2008
2008-11-05 12:41:07
2008-11-05
12:41:07
Wed Nov 05 00:00:00 EST 2008
Thu Jan 01 12:41:07 EST 1970
Job tFileList_filter ended at 12:41 05/11/2008.
Anonymous
Not applicable
Author

Hello
I am using TalendDate.parseDate("dd/MM/yyyy", row1.value1) to make my value1 (which is in String) to Date. It works but if i let the field null, i have an error message unpaseable field "".
how can i solve it?
thanks
Anonymous
Not applicable
Author

thanks for posting that question... Smiley Happy waiting for replies
Anonymous
Not applicable
Author

I am still asking, is timestamp and date are the same thing ?
Anonymous
Not applicable
Author

well , you can set default value as "0000-00-00 00:00:00" even for date in Talend , even though the corressponding field is timestamp type in ur table.It works for me. And at the same time , also use:- TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",context.myDate)
Anonymous
Not applicable
Author

weel if you should put 00/00/0000 it sould be worked, but i would like to let nothing in it like "".
What is the difference between formatDate and parseDate?