Need help on RT scrip to get UTC+7

Hi, I try to create scrip to add date+time in custom field with UTC+7 timezone but I got UTC+0 timezone as result. Have I done something wrong?

Custom action commit code:

my $date = new RT::Date($self->CurrentUser);
my ($status, $msg) = $self->TicketObj->AddCustomFieldValue( Field =>114, Value => $date->ISO(Timezone=>‘Asia/Bangkok’));
my ($status, $msg) = $self->TicketObj->AddCustomFieldValue( Field =>8, Value => $date->ISO(Timezone=>‘Asia/Bangkok’));
unless ( $status ) {
$RT::Logger->error(“Couldn’t change assignTime: $msg”);
return 0;
return 1;

I rarely have to play with timezones, but from reading the RT::Date documentation it appears that Timezone can take one of three values: user, system or utc. If it isn’t specified or has a value other than those three it uses utc (which is why your Asia/Bangkok was treated as UTC).

So if your RT system is running in ‘Asia/Bangkok’, or the user has that as their timezone, you could use either system or user timezone options. But I suspect that the RT::Date is going to be stored in UTC still (with the offset applied from those timezones).

1 Like