Timothy 2 was written by Apostle Paul around 67 A.D. It was his last letter before he was executed by the Romans (probably by decapitation).
Apostle Paul wrote this letter to Timothy (or Saint Timothy) while he was imprisoned in Rome again, and for the last time, so this was kind of a farewell note. Judging from the somber nature of the work, Paul knew that his mission was over and that his life on earth would end soon. Paul wrote this epistle to urge Timothy (as well as other believers) to stand firm and strong in faith, to warn him of the coming days of godlessness, as well as to encourage Timothy to continue to preach the Gospel.