How to get only hours on Date/Time field on Script Include?

Mutsumi
Kilo Contributor

How to get only hours on Date/Time field on Script Include?

I'd like to compare current "hours" of Glide time and "hours" of sys_created_on (Date/Time type).

1 ACCEPTED SOLUTION

Alikutty A
Tera Sage

Hi,

You can use this logic in your script include

var datetime = new GlideDateTime(record.sys_created_on).toString().split(" "); //Replace record with your glide record
var time = datetime[1].split(":");
var hour = time[1];
gs.info(hour);

View solution in original post

2 REPLIES 2

Alikutty A
Tera Sage

Hi,

You can use this logic in your script include

var datetime = new GlideDateTime(record.sys_created_on).toString().split(" "); //Replace record with your glide record
var time = datetime[1].split(":");
var hour = time[1];
gs.info(hour);

Thank you so much for the solution!