KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How do I tweak this to get yesterday's date using localtime? use strict; sub spGetCurrentDateTime; print spGetCurrentDateTime; sub spGetCurrentDateTime { my ($sec, $min, $hour, $mday, $mon, $year) = localtime(); my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); my $currentDateTime = sprintf "%s %02d %4d", $abbr[$mon], $mday, $year+1900; #Returns => 'Aug 17 2010' return $currentDateTime; } ~
Tags (comma-separated)
Save Edits
Cancel