[rt-users] Searching and comparing two date field values instead of value with supplied valid

Landon landonstewart at gmail.com
Mon Aug 12 14:48:41 EDT 2013


On 12 August 2013 11:45, Thomas Sibley <trs at bestpractical.com> wrote:

> On 08/12/2013 11:39 AM, Landon wrote:
> > The help I need though is on comparing dates using RT::Date or
> > something.  If I load the CF.{ServerCreated} and the Created value how
> > do I compare them reliably in modules?
> >
> > Would this work?
> > ...
> > my $ServerCreated = DateTime::Format::MySQL->parse_datetime(
> > $ticket->FirstCustomFieldValue('ServerCreated') );
> > my $Created = DateTime::Format::MySQL->parse_datetime(
> > $ticketObj->Created );
> > $ticket->SetStatus( 'resolved' ) if $ServerCreated < $Created;
> > …
>
> my $server_created = RT::Date->new( $ticket->CurrentUser );
> $server_created->Set(
>     Format => 'sql',
>     Value  => $ticket->FirstCustomFieldValue('ServerCreated'),
> );
>
> if ($server_created->Unix < $ticket->CreatedObj->Unix) {
>     ...
> }
>
>
Oh niiice.  Thanks Thomas!


-- 
Landon Stewart <LandonStewart at Gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130812/73023b7a/attachment.htm>


More information about the rt-users mailing list