Before answering the question directly as asked, I would like to add few personal comments:
This has been a growing culture for Ph.D. research in many developing countries including India to focus on Impact Factor of a journal before submitting the work.
However, although it makes sense to say about your publication by quantifying the quality of the journal based on so-called "SCI Impact Factor", it is not wise at all.
The Impact Factor is an evaluated value of a function that takes into account all publications till that year under that journal. So, Impact Factor alone is misleading to say that "I have published my work in Journal of X which has an impact factor of 5.095"
Now coming to your questions:
Impact factor is valid only for a year
Yes. Unless the computation results in the same value for the following years.
If I publish in a journal which says having an impact factor (2015), can I claim it when I publish in 2017?
No. Actually, you can not claim anything based on this impact factor. If I were to ask you about it, I would ask you this question: "Did your paper contributed anything to the 2015 impact factor?" If your answer is "NO". You can not claim it.
People may disagree with my answer. My answer is based on my personal understanding in the field of CS and Applied CS.