[rt-users] Wrong due date output, related to "SetToMidnight" ?
Curtis Bruneau
curtisb at vianet.ca
Thu Aug 20 12:28:18 EDT 2009
Also wanted to note the would probably fail if ran near the end of the
day, you may want to specify a specific $time in gmtime($time),
localtime($time).
Curtis Bruneau wrote:
> I've had the same issue setting due dates in a scrip, I've done the
> following to somewhat accurately go back (usual DST issues apply). I
> imagine there might be cleaner ways. $1 being an ISO format, I'm parsing
> from the email. I hope that helps.
>
> my $duedate = RT::Date->new($RT::SystemUser);
> $duedate->Set(Format=>'ISO', Value=>"$1");
>
> my $localdate =
> $duedate->AddSeconds(((gmtime)[2]-(localtime)[2])*60*60);
> # ^^ this will add the difference from gmtime.
> $duedate->Set(Format=>'unix', Value=>$localdate);
> $self->TicketObj->SetDue( $duedate->ISO );
>
> David wrote:
>
>> Hi,
>>
>> I have a scrip that triggers a template in which the due date of the
>> ticket is displayed.
>> In the template, I output the due date as such:
>>
>> This ticket is due in {$Ticket->Due}.
>>
>> Now, this works properly unless the due date is exactly midnight (00:00:00).
>> I would expect to have the right due date in the ticket.. but instead,
>> I get 04:00:00.
>>
>> After looking through the doc, I see that this could be due to
>> SetToMidnight which uses GMT rather than the local server time.
>>
>> Is there some way to fix this ? We'd like to have tickets that are due
>> on midnight as we have a 24/7 operation :)
>>
>> Thanks,
>>
>> David
>> _______________________________________________
>> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>>
>> Community help: http://wiki.bestpractical.com
>> Commercial support: sales at bestpractical.com
>>
>>
>> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
>> Buy a copy at http://rtbook.bestpractical.com
>>
>>
>>
>>
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>
>
>
More information about the rt-users
mailing list