Question: when was when i was your man written
Answer: `` When I Was Your Man '' is a song recorded by American singer and songwriter Bruno Mars for his second studio album , Unorthodox Jukebox ( 2012 ) .