[rt-users] Wrong due date output, related to "SetToMidnight" ?

Ruslan Zakirov ruslan.zakirov at gmail.com
Thu Aug 20 15:47:38 EDT 2009


Heh, I didn't get problem at first. In 3.8 we fixed this, there is
Timezone argument in the SetToMidnight function. By default it's
"utc", but "system" or "user" can be used.

On Thu, Aug 20, 2009 at 8:28 PM, Curtis Bruneau<curtisb at vianet.ca> wrote:
> 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
>>
>>
>>
>
> _______________________________________________
> 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
>



-- 
Best regards, Ruslan.



More information about the rt-users mailing list