Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How to store the Date and Time values in context variable and write into a csv file.
You can get the current Date and Time using built-in function TalendDate.getCurrentDate(), eg:
on a tJava:
context.currentDate=TalendDate.getCurrentDate();
context.stringDatePart=TalendDate.formatDate("yyyy-MM-dd",context.currentDate);
context.stringTimePart=TalendDate.formatDate("HH:mm:ss",context.currentDate);
System.out.println(context.currentDate);
System.out.println("the date part is: "+context.stringDatePart);
System.out.println("the time part is: "+context.stringTimePart);
Get the current Date and Time, store them into context variables, use these context variables later on other components.
If you need to output the Date and Time to CSV, just use a tfixedFlowInput to generate the data flow.
Hope it helps you!
Regards
Shong
Hi
Do you want to get the current Date and Time? Can you show an example what data you want? So we can give your more precise answer?
Regards
Shong
Hi Shong,
As I mentioned that I want to create a job which can write the current Date and Time in csv file i.e, whenever I run the job current time should be stored in my csv file. But the problem is I am not able to do using context variable. Hope it is clear now.
Thank and Regards
Amit Yadav
You can get the current Date and Time using built-in function TalendDate.getCurrentDate(), eg:
on a tJava:
context.currentDate=TalendDate.getCurrentDate();
context.stringDatePart=TalendDate.formatDate("yyyy-MM-dd",context.currentDate);
context.stringTimePart=TalendDate.formatDate("HH:mm:ss",context.currentDate);
System.out.println(context.currentDate);
System.out.println("the date part is: "+context.stringDatePart);
System.out.println("the time part is: "+context.stringTimePart);
Get the current Date and Time, store them into context variables, use these context variables later on other components.
If you need to output the Date and Time to CSV, just use a tfixedFlowInput to generate the data flow.
Hope it helps you!
Regards
Shong
Thanks Shong,
It worked for me.