Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to get first and last day in a year

How to get first and last day in a year 

 

for example i have 10 years i have to get first and last day for every year

Labels (2)
3 Replies
Martintin
Contributor III
Contributor III

Hi @saravanan_ehkn ,

 

What do you mean by first/last day ? 

You want to know which of the week is it ? Like monday,tuesday ... ?

 

Regards,

Martin

Anonymous
Not applicable
Author

for example if you are taking 2019 as a year
i want first_day_of_year as 1/1/2019
last_day_of_year as 31/12/2019
Martintin
Contributor III
Contributor III

Here is what i did in a tjava just to test :

String annee = "2019";

String first_day_of_the_year = "01/01/".concat(annee); 
String last_day_of_the_year = "31/12/".concat(annee); 

//If type date needed
Date date1 = new Date(first_day_of_the_year);
Date date2 = new Date(last_day_of_the_year);

If your var are Strings, you can do it by concatenating the year with the fixed first and last day of the year.

And if it is date, you can create a date with the string in argument and define the column date format to fit with the format you want.

 

Regards,

Martin