Is is there a way to get the weekday?

One Star

Is is there a way to get the weekday?

Hi,
is there a way to get the weekday by Talend functions? And can I get it formated locale (this case in pt-br)?
Thanks.
One Star

Re: Is is there a way to get the weekday?

like, you want to know what the current day of the week is? or what day of the week a certain date falls on?
if you hit CTRL-Space, in a field you can input formulas/code into, it will pop down a list of available variables and functions (see attached pic)
here are some, various, talend date formula options:
TalendDate.getCurrentDate()
TalendDate.getDate("CCYY-MM-DD hh:mm:ss")
TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",myDate)
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss","")

and what does pt-br mean?
there look to be two date functions that deal with Locale:
TalendDate.formatDateLocale("yyyy-MM-dd HH:mm:ss",myDate,"EN")
TalendDate.parseDateLocale("yyyy-MM-dd HH:mm:ss","","EN")

http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
One Star

Re: Is is there a way to get the weekday?

I tried these functions, but havent found one that match my needs....
I want to get the current weekday (ex. Friday), but in portuguese (ex. Sexta).
I think it would be like: TalendDate.formatDateLocale("Weekday",TalendDate.getDate("Weekday")
,"PT"). Is this possible? How is the correct command?
One Star

Re: Is is there a way to get the weekday?

you were using the wrong name/code for weekday (see "Date and Time Patterns" table in http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html)
also, TalendDate.getDate() returns a string value, and you need to return a date value to be able to use the formatDateLocale formula
for the abbreviated name
TalendDate.formatDateLocale("E",TalendDate.getCurrentDate(),"PT")

for the full name
TalendDate.formatDateLocale("EEEE",TalendDate.getCurrentDate(),"PT")
One Star

Re: Is is there a way to get the weekday?

Thanks, It worked great.
One Star

Re: Is is there a way to get the weekday?

Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK", TalendDate.getCurrentDate() )-1)

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog