problem with Date

Hi,

I have a string column with "Thu Oct 02 07:50:43 CEST 2014". I need to parse this string to have a Date. The node String to Date/Time with EEE MMM dd HH:mm:ss zzz yyyy raise an error. I don't know why. A java snippet seem to works:

Calendar c = Calendar.getInstance();
c.setTime(new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy",Locale.ENGLISH).parse(c_Col0));
out_Col0 = c.getTime();
n.warn(out_Col0);

This code print Thu Oct 02 07:50:43 CEST 2014 but if i see the resulted table into the column there is 2014-10-02T05:50:43.0. Why?

Thanks

 
 

Just to answer your second question.

In "Table creator" you wrote CEST which is Central European Summer Time and is UTC+2. That's why your get difference of 2 hours. Java Snippet outputs time in UTC timezone in your case.

Thanks...but

if i use in input Thu Oct 02 07:50:43 2014 parsed with EEE MMM dd HH:mm:ss yyyy i got in output the same error: 2014-10-02T05:50:43.0.

Why?

Because, as pskale wrote, internally all dates are stored in UTC.

If i remove the string "CEST" i don't expect that the program changes the date.  Knime can't know the right timezone of the date in input. Does it subtract 2 to every date?

It either uses the specified timezone or your local timezone. Then it's converted into UTC and for CEST this currently means to substract 2 hours.