i created a datetime constant for use in a few of my scripts that run on Win32 && *NIX, for use in creating temporary directories and files. here's a snippet you may find helpful.
use POSIX;
use constant DATETIME => strftime("%Y-%m-%d_%H-%M-%S", localtime);