Zoho CRM Deluge - Converting Date/Time field to format "5:30 PM" with original timezone

Zoho CRM Deluge - Converting Date/Time field to format "5:30 PM" with original timezone

EDIT: This is resolved.  The solution is the following:

Appointment_Date_Time="2023-02-23T10:30:00-08:00"
Appointment_Date_Time.toTime("yyyy-MM-dd'T'HH:mm:ss").toString("HH:mm a", "PST");

-------------

Hello!

I'm trying to turn a Date/Time field (i.e. "2023-02-23T10:30:00-08:00") into the following format: "h:mm a", like "2:30 PM" or "8:00 AM".

I was able to solve it with the following code, but a built-in solution would be great.

Appointment_Date_Time="2023-02-23T10:30:00-08:00"
am_or_pm = "AM";
hours = Appointment_Date_Time.toTime("yyyy-MM-dd'T'HH:mm:ss").hour().toString().toNumber();
minutes = Appointment_Date_Time.toTime("yyyy-MM-dd'T'HH:mm:ss").minute();
if(!isEmpty(hours) && !isNull(hours))
{
if(hours >= 12)
{
hours = hours - 12;
am_or_pm = "PM";
}
if(!isEmpty(minutes) && !isNull(minutes))
{
if(minutes <= 9)
{
minutes = "0" + minutes.toString();
}
finalTime = hours + ":" + minutes + " " + am_or_pm;
info finalTime;
}
}