Skip to main content
Question

Formatting time variables in Substitution Keywords

  • October 13, 2024
  • 2 replies
  • 46 views

Forum|alt.badge.img+5

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?

2 replies

WilsonX
Sidekick (Employee)
Forum|alt.badge.img+5
  • Sidekick (Employee)
  • 23 replies
  • October 17, 2024

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.


Forum|alt.badge.img+5
  • Author
  • Sidekick (Customer)
  • 8 replies
  • October 17, 2024

Perfect. Thanks very much for your help.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings