no timestamp data type in talend?

One Star

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
One Star ead
One Star

Re: no timestamp data type in talend?

I also want to know an answer to it please.
One Star

Re: no timestamp data type in talend?

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
One Star ead
One Star

Re: no timestamp data type in talend?

amm and is the same as the timestamp format ?
One Star

Re: no timestamp data type in talend?

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.

Re: no timestamp data type in talend?

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
One Star

Re: no timestamp data type in talend?

thanks for posting that question... Smiley Happy waiting for replies
One Star ead
One Star

Re: no timestamp data type in talend?

I am still asking, is timestamp and date are the same thing ?
One Star

Re: no timestamp data type in talend?

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)

Re: no timestamp data type in talend?

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?
One Star

Re: no timestamp data type in talend?

if your row1 is nullable you can write this :
(row1.value1==null)?null:TalendDate.parseDate("dd/MM/yyyy", row1.value1)
with this formula if value1 is null the expression will return null else it will use the TalendDate.parseDate method
please notice that this formula is usefull if you don't want to have nullPointerException using a method
cheer

Re: no timestamp data type in talend?

ok thanks that works execpt that i don't do
(row1.value1==null)?null:TalendDate.parseDate("dd/MM/yyyy", row1.value1) but i do

(row1.value1.equals("")?null:TalendDate.parseDate("dd/MM/yyyy", row1.value1)
One Star

Re: no timestamp data type in talend?

What is the difference between formatDate and parseDate?

when you press CTRL-SPACE and the list pops up/down, if you click on a formula once, a box should pop up to the side telling you about that formula
but from what i recall, parseDate takes a string value and makes it into a date. formatDate takes a date value and makes it into a string

I am still asking, is timestamp and date are the same thing ?

http://java.sun.com/j2se/1.5.0/docs/api/java/util/Date.html
The class Date represents a specific instant in time, with millisecond precision.

if your row1 is nullable you can write this :
(row1.value1==null)?null:TalendDate.parseDate("dd/MM/yyyy", row1.value1)
with this formula if value1 is null the expression will return null else it will use the TalendDate.parseDate method
please notice that this formula is usefull if you don't want to have nullPointerException using a method
cheer

I'm glad I decided to read through the rest of the topic before posting to use an if statement, since you've already told him how to do it, and cleaner than I was going to suggest
One Star

Re: no timestamp data type in talend?

Hello ,
I have an issue with MSSQL.
I have a field in a MSSQL table of TIMESTAMP datatype. I didn?t find a corresponding type in Talend
So I used the ?date? type. Unfortunately, it doesn?t load the data in MSSQL table and I have the following error message:
Disallowed implicit conversion from data type datetime to data type timestamp,
table 'IT_Test.Invoice', column 'TS'.
Use the CONVERT function to run this query.
The ?date? type in Talend seems not to be compatible with ?timestamp? in MSSQL server.
Do you have any ideea what to do ?
Thank you very much !
Gabi
Community Manager

Re: no timestamp data type in talend?

Hello ,
I have an issue with MSSQL.
I have a field in a MSSQL table of TIMESTAMP datatype. I didn?t find a corresponding type in Talend
So I used the ?date? type. Unfortunately, it doesn?t load the data in MSSQL table and I have the following error message:
Disallowed implicit conversion from data type datetime to data type timestamp,
table 'IT_Test.Invoice', column 'TS'.
Use the CONVERT function to run this query.
The ?date? type in Talend seems not to be compatible with ?timestamp? in MSSQL server.
Do you have any ideea what to do ?
Thank you very much !
Gabi

What's your data looks like in mssql table?
Have you defined the date pattern on schema? For example, here is a data in mssql table 2009-10-12 15:14:10, you should define the date pattern on schema asSmiley Sadsee my screenshot)
"yyyy-MM-dd HH:mm:ss"
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: no timestamp data type in talend?

Hi Shong,
Yes, I've defined exactly like in MSSQL, which is "yyyy-MM-dd HH:mm:ss"
I still get the error :
Disallowed implicit conversion from data type datetime to data type timestamp
One Star

Re: no timestamp data type in talend?

i have input table contains:
abc, 20
xyz,45
and i m mapping directly in tmap from input to output and connecting to output table(toraclebulkexec)
now i m getting output like;
"abc",20
"xyz",45
why i m getting double quotes
how can i remove double quotes
help me pls.
One Star

Re: no timestamp data type in talend?

hi all,
i thought this thread was relevant to ask my question.
i have a string "yyyy-mm-dd HH:mm:ss" for example "2011-04-23 17:23:26". how do i convert this string to date using talend?
One Star

Re: no timestamp data type in talend?

hi
use TalendDate.parseDate("yyyy-MM-dd HH:mm:ss","2011-04-23 17:23:26")
One Star

Re: no timestamp data type in talend?

Thanks a lot!