I wrote a perl script to get datetime. It do work but I do wonder if there any easier way to format date as output.
#!/usr/bin/perl use DateTime; my $dt
Sure, use POSIX module:
The POSIX module permits you to access all (or nearly all) the standard POSIX 1003.1 identifiers.
Example:
use POSIX; print POSIX::strftime('%d-%m-%Y %H:%M:%S', localtime());