Skip to main content

Has anyone had to used time variables in substitution keywords?

I’ve got a form with a date field DATETIME and am using two substitution keywords to present the date and time on an action template. Date works fine but I’m having trouble formatting the time as either 24 hour clock or with an AM/PM label.

$date.format('hh:mm',$new.event.W("DATETIME")) is presenting the time correctly, in the format 11:00. In the context of the related action template I really need to specify 23:00 or 11:00 PM.

Does anyone have any ideas?

It seems you're close, but you're using the 12-hour format (hh:mm) in your $date.format function. To resolve this and either specify the 24-hour clock or add an AM/PM label in IFS Assyst, you can adjust the format string to suit your needs:

  1. For a 24-hour clock: Use HH:mm instead of hh:mm. The HH represents the hour in 24-hour format.

    Copiar código

    $date.format('HH:mm', $new.event.W("DATETIME"))

    This will return 23:00 for 11 PM.

  2. For a 12-hour clock with AM/PM: You can add an AM/PM suffix by using a in the format string.

    Copiar código

    $date.format('hh:mm a', $new.event.W("DATETIME"))

    This will return 11:00 PM or 11:00 AM as appropriate.


Perfect. Thanks very much for your help.


Reply