use POSIX 'strftime'; # NOTE: 86_400 seconds in a day. $yesterdays_month = strftime('%b', time - 86_400);