Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

difference between month and year function

Hi QV,

Can any one explain differences between below functions with sample exampls.

Month Functions:

--------------------

1)AddMonths

2)MonthStart

3)MonthEnd

4)SetDateYearMonth

5)MonthName and MonthsName

Year Functions

----------------------

YearStart

YearEnd

SetDateYear

YearName

WeekYear

1 Solution

Accepted Solutions
MayilVahanan

HI

Please see the example which you can understand easily

AddMonths(Today(),2) gives 24/8/2014

AddMonths(Today(),-2) gives 24/4/2014

MonthStart(Today()) gives 1/6/2014

MonthStart(Today(), -2) gives 1/4/2014

MonthEnd similar to MonthStart

SetDateYearMonth(Today(), 2012 , 1) gives 24/1/2012

MonthName (Today()) gives Jun 2014

MonthsName(2,Today()) gives May-Jun 2014

     Returns a display value showing the months of the period (formatted according to the MonthNames script variable) and year with an underlying numeric value corresponding to a timestamp with the first millisecond of the n month period (starting from January 1st) containing date. N must be (1), 2, (3), 4 or 6. Shift is an integer, where the value 0 indicates the period which contains date. Negative values in shift indicate preceding periods and positive values indicate succeeding periods. If you want to align with (fiscal) years not starting in January, indicate a value between 2 and 12 in first_month_of_year.

YearStart(Today()) - gives 1/1/2014

YearEnd(Today()) - gives 31/12/2014

SetDateYear(Today(), 2012) gives 24/06/2012

Yearname(Today()) gives 2014

     Returns a four-digit year as display value with an underlying numeric value corresponding to a timestamp with the first millisecond of the first date of the year containing date

WeekYear(Today()) gives 2014

The year to which the week number belongs.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

3 Replies
MayilVahanan

HI

Please see the example which you can understand easily

AddMonths(Today(),2) gives 24/8/2014

AddMonths(Today(),-2) gives 24/4/2014

MonthStart(Today()) gives 1/6/2014

MonthStart(Today(), -2) gives 1/4/2014

MonthEnd similar to MonthStart

SetDateYearMonth(Today(), 2012 , 1) gives 24/1/2012

MonthName (Today()) gives Jun 2014

MonthsName(2,Today()) gives May-Jun 2014

     Returns a display value showing the months of the period (formatted according to the MonthNames script variable) and year with an underlying numeric value corresponding to a timestamp with the first millisecond of the n month period (starting from January 1st) containing date. N must be (1), 2, (3), 4 or 6. Shift is an integer, where the value 0 indicates the period which contains date. Negative values in shift indicate preceding periods and positive values indicate succeeding periods. If you want to align with (fiscal) years not starting in January, indicate a value between 2 and 12 in first_month_of_year.

YearStart(Today()) - gives 1/1/2014

YearEnd(Today()) - gives 31/12/2014

SetDateYear(Today(), 2012) gives 24/06/2012

Yearname(Today()) gives 2014

     Returns a four-digit year as display value with an underlying numeric value corresponding to a timestamp with the first millisecond of the first date of the year containing date

WeekYear(Today()) gives 2014

The year to which the week number belongs.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Please see the help in the Qlikview desktop. Its has been explained very well in that.

Not applicable
Author

Please find attached a sample App ! ! !