When writing Perl scripts I frequently find the need to obtain the current time represented as a string formatted as YYYY-mm-dd HH:MM:SS (say 2009-11-29 14:28
YYYY-mm-dd HH:MM:SS
2009-11-29 14:28
Short and sweet, no additional modules needed:
my $toDate = `date +%m/%d/%Y" "%l:%M:%S" "%p`;
Output for example would be: 04/25/2017 9:30:33 AM