CA Service Management

Expand all | Collapse all

How to Display or Store time part (HH:MM am\pm) of a Date Time field?

Jump to Best Answer
  • 1.  How to Display or Store time part (HH:MM am\pm) of a Date Time field?

    Posted 12-08-2015 11:02 AM

    I have a requirement where I need to display the start time (HH:mm am\pm) of a Maintenance Window in a ticket. With an SPL I'm able to get the Start Date of the Maintenance Window to the ticket and display it in a text field. Now I only need the Time part.

     

    Example:

    Maintenance Window Start Date: 10/30/2015 05:00 am

    Maintenance Window End Date: 10/30/2015 05:00 pm

     

    Need to Display:

    Maintenance Window Start Date: 05:00 am

    Maintenance Window End Date: 05:00 pm

     

    Note:

    Client does not wants to use the View Scheduler Button and it is aware that only one of the related maintenance windows to the CI will show up.

     

    Regards,

     

    Jose



  • 2.  Re: How to Display or Store time part (HH:MM am\pm) of a Date Time field?
    Best Answer

    Posted 12-08-2015 04:08 PM

    hi,

    if you need to display values on the htmpl forms, you can use js:

    detailRowHdr('Row Header');

    detailSetRowData('$args.z_attr'.substr('$args.z_attr'.indexOf(' ')+1)); // convert to string via date_to_string('$args.z_attr') if needed

    othervise you can use SPEL in same way:

    string time;

    time = substr(z_attr, (sindex(z_attr, ' ')+1));

    Regards,

    cdtj



  • 3.  Re: How to Display or Store time part (HH:MM am\pm) of a Date Time field?

    Posted 12-08-2015 04:34 PM

    Thanks!!!

    I tried the js and it does the job.

     

    The date_to_string is needed for date field.