For example, it's March 2015. I can get the next month of the current year using
month()+1 concatenating with
year() , that is, the month of April 2015. But let's say it's December 2015, How do I automatically get the month of January and the year 2016 ? Is there any function that does this without me having to compare the month?
You can add or remove time intervals to a date with the DateAdd function, 3 it is necessary to inform 3 arguments: the interval, quantity and date.
yyyy | Ano q | Quarto m | Mês y | Dia do ano d | Dia w | Dia da semana ww | Semana h | Hora n | Minuto s | Segundo
<% data = "2015-01-01" response.write month(DateAdd("m", -1, data)) &" - "& year(DateAdd("m", -1, data)) response.write month(DateAdd("m", 12, data)) &" - "& year(DateAdd("m", 12, data)) %>
12 - 2014 1 - 2016