Set Datetime in script and add time for different time zone

Does anyone have script to convert free text date and time to datetime in scrip and then add/minus time for different time zone ?
How to set it back to datetime custom field?

It is hard to figure out how to code it because no much examples to follow and make you understand to use the objects and method.

Please kindly advise.

You can take a look at the docs for RT::Date there are methods like Set where you can provide some args:

my ($ret, $msg) = $date->Set( Format => 'unknown', Value => $some_date, Timezone => 'UTC' );

https://docs.bestpractical.com/rt/4.4.4/RT/Date.html#Set

I try to set datetime value to datetime or text custom field using AddCustomFieldValue but both are failed with not set.

What is the error message?

my $date = RT::Date->new($ticket->CurrentUser);
my ($ret, $msg) = $date->Set( Format => 'unknown', Value => '3 days ago' );
RT::Logger->error($msg) unless $ret;

my ($ret, $msg) = $date->AddSeconds(100);
RT::Logger->error($msg) unless $ret;

my ($ret, $msg) = $ticket->AddCustomFieldValue( Field => 'Foo', Value => $date->ISO );
RT::Logger->error($msg) unless $ret;