Getting 1970-01-03 12:13:00 as a output when accessing values from glideduration type field.

Mark Wood
Tera Contributor

Hello Experts,

I have created a field named "repeat" with a data type of "glide-duration." My requirement is to access these values in datetime format. How can I achieve this? I have attached a screenshot below for reference. Please guide me on this. Thank you.

9 REPLIES 9

Brad Bowman
Kilo Patron
Kilo Patron

Hi Mark,

This value indicates a duration of 2 days 12 hours 13 minutes.  What is an example of the format you are looking for?

Suppose today is 10-10-2023 at 12:13:00 as per duration of the repeat field our output should be 12-10-23 00:26:00 I hope you got my requiremnt.

This will add the duration value to the current date and time:

var nowdt = new GlideDateTime();
nowdt.getDisplayValue;
var dur = current.u_dur_name.dateNumericValue(); //name of your duration field
nowdt.add(dur);
gs.addInfoMessage(nowdt.getDisplayValue());

Hello @Brad Bowman  ,

it's working fine. Thank you so much. Just one doubt: can I compare two date times, including AM and PM? In my requirement, there is one custom field named "future schedule date." When the future schedule date matches the current date and time, I want to send a notification. I know the "equals" method, but I think that method will not compare AM and PM. How can I compare, please guide me. It will be really helpful for me.

Thank you once again.