Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have tried the below and this is printing Jan 1 2017.
System.out.println(TalendDate.parseDate("MM/DD/YYYY HH:mm:ss", TalendDate.getDate("MM/DD/CCYY HH:mm:ss")));
TalendDate.getDate("MM/DD/CCYY HH:mm:ss") - This part is giving current date time in given format and I need this string as date data type. When I use parsedate, it is printing 1/1/2017.
Hi,
A Date is a Date, a formated Date is a date represented by a String.
Can you explain a little more what's expectation?
System.out.println(TalendDate.formatDate("MM/dd/yyyy HH:mm:ss",TalendDate.getCurrentDate()));
Result (based on Europe/Paris TZ current datetime 😞
12/08/2017 14:45:47
Hi, Thanks for your response.
The formatted date that's a string need to be loaded to a database table where the filed datatype is date. So, the formatted date as a string is unable to get into the date field of the table.
Yes, I tried loading that directly. Because it prints time zone in it, I had invalid character issues. I will format this at the database end. Thank you
Hello,
the above syntax TalendDate.formatDate("yyyyMMddHHmmss",TalendDate.getCurrentDate()) with the hours,
I used on my job,where there is a shift of 2 hours.For example by using the above syntax, when I insert a line in a table at 20/09/2019 8h00,but in my table the I see the line is inserted at 20/09/2019 6h00.
I don't why its happeneing .
Could someone tell me the reason or propose other syntax please?
Hi TRF.
Thanks for your reply.
But I want to charge this value in a variable for a properties file. How can I do that with Talend?
Hello,
You can use the composant tfixedflowinput and you create a column for example col1 and give value as TalendDate.getDate("yyyyMMdd") and tmaps is not compulsory to use it and to charge in your properties file,it depends on what kind of file format you will use it.It can be in txt,csv or dat etc.