I agree with the other posters that localtime is better to use. But I disagree with the implied suggestion that one should parse the output of localtime. Nor would I use localtime in list context and do some mapping from numbers to strings.
POSIX::strftime is your friend (man POSIX).