[rt-users] Problem with date

Bryon Baker bbaker at copesan.com
Wed Nov 19 14:18:25 EST 2014


I am attempting use  the following code to update the Resolved date in a ticket.  Thanks for the help in advance.

package RT::Action::CSRUpdateResolvedTest;
use base 'RT::Action';
use strict;
use warnings;

sub Prepare
{
                return 1;
}

sub Commit
{

                my %mon2num = qw(
                                jan 1  feb 2  mar 3  apr 4  may 5  jun 6
                                jul 7  aug 8  sep 9  oct 10 nov 11 dec 12
                );
                my $self = shift;
                my $ticket = $self->TicketObj;
                my $datecreated = $ticket->CreatedObj->Unix;
my $dateupdated = $ticket->LastUpdatedObj->Unix;
my $datecreatedstr = $ticket->CreatedObj->AsString;
my $dateupdatedstr = $ticket->LastUpdatedObj->AsString;
                my $dateresolved;
                my $dateresolvedstr;
                my @dateresolvedstr;
                my $transactions = $ticket->Transactions;
                $transactions->Limit( FIELD => 'Type', VALUE => 'Status', FIELD => 'NewValue', VALUE => 'closed');
                while (my $transaction = $transactions->Next)
                {
            $dateresolved = localtime($transaction->CreatedObj->Unix);
                           @dateresolvedstr = split(" ",$dateresolved);
                           $dateresolvedstr = $dateresolvedstr[4] . "-" . $mon2num{lc substr($dateresolvedstr[1], 0, 3)} . "-" . $dateresolvedstr[2] . " " .  $dateresolvedstr[3];
                 }

                print $dateresolvedstr . " " . $dateresolved . "\n";
                $ticket->SetResolved($dateresolvedstr);

                return 1;
}

The dates printed to the console are correct but when I view the ticket the resolved date is different than the dates printed to the console by 6 hours.  This seems to me to be the off set for the time zone.  What do I need to add for Request Tracker to take the date as is?

Thanks
Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726  *  262-783-6261 ext. 2296
bbaker at copesan.com<mailto:cstephan at copesan.com>
www.copesan.com<http://www.copesan.com/>
"Servicing North America with Local Care"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20141119/a14f943d/attachment.htm>


More information about the rt-users mailing list