How to find first and last day of a year

Six Stars

How to find first and last day of a year

hi

 

i need to find first and last day of an year 

 

 

for exmaple : in the year is 2019 in need first day as 01-01-2019 and last day as 31-12-2019

 

Six Stars

Re: How to find first and last day of a year

Hi,

 

 

Can you provide some sample data.

 

 

Thanks,

Jagan.

Highlighted
Community Manager

Re: How to find first and last day of a year

Get the year number of a Date using built-in function TalendDate.getPartOfDate("YEAR", Date date), eg:
TalendDate.getPartOfDate("YEAR", row1.columName), and then you are able to get the first day and the last day of a year with string value.
first day: "01-01-"+TalendDate.getPartOfDate("YEAR", row1.columName)
last day: "31-12-"+TalendDate.getPartOfDate("YEAR", row1.columName)

If you need to convert the string value to a Date, using this expression:
TalendDate.parseDate("dd-MM-yyyy","31-12-"+TalendDate.getPartOfDate("YEAR", row1.columName))

Hope it helps you!

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

2019 GARTNER 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

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog

Talend Integration with Databricks

Take a look at this video about Talend Integration with Databricks

Watch Now