POSIX::strftime

use POSIX qw(strftime);

print strftime('%F %H:%M', localtime), "\n";

print strftime('It is %r on %A', localtime), "\n";
2005-03-14 17:58
It is 05:58:01 PM on Monday