X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=maps%2Fbin%2FMAPSUtil.pm;h=82f7bc7ea4d48ec21ccb81f85ab94b385ba256da;hb=ec9dcaa8edb34b1d8be0ce254423294f01ae48ab;hp=2298d77dad0b861c6847054cfcc6c80ae75297ea;hpb=95525f583d9d7df558a17b4cae6fbb841701c1be;p=clearscm.git diff --git a/maps/bin/MAPSUtil.pm b/maps/bin/MAPSUtil.pm index 2298d77..82f7bc7 100644 --- a/maps/bin/MAPSUtil.pm +++ b/maps/bin/MAPSUtil.pm @@ -17,6 +17,10 @@ package MAPSUtil; use strict; use vars qw (@ISA @EXPORT); +BEGIN { + $ENV{TZ}='America/Los_Angeles'; +} # BEGIN + @ISA = qw (Exporter); @EXPORT = qw ( @@ -33,15 +37,18 @@ sub Today2SQLDatetime; sub FormatDate { my ($date) = @_; - return substr $date, 5, 2 . '/' . - substr $date, 8, 2 . '/' . - substr $date, 0, 4; + return substr ($date, 5, 2) . '/' . + substr ($date, 8, 2) . '/' . + substr ($date, 0, 4); } # FormatDate sub FormatTime { my ($time) = @_; my $hours = substr $time, 0, 2; + + $hours = substr $hours, 1, 1 if $hours < 10; + my $minutes = substr $time, 3, 2; my $seconds = substr $time, 6, 2; my $AmPm = $hours > 12 ? 'Pm' : 'Am'; @@ -141,9 +148,9 @@ sub SubtractDays { $month = '0' . $month; } # if - # Prefix days with 0 if necessary - if ($days eq 0) { - $days = '01'; + # Prefix days with 0 if necessary + if ($days == 0) { + $days = '01'; } elsif ($days < 10) { $days = '0' . $days; } # if