- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 12:09 PM
Got time field on table and want to set it on RITM variable.
var today = new GlideDateTime();
var gr = new GlideRecord('u_sam_tb');
gr.addQuery('sys_id', current.variables.ids);
gr.setLimit(1);
gr.query();
if (gr.next()) {
var dTime = new GlideDateTime(gr.getValue('u_time'));
var dTimeStrg = new GlideDateTime(dTime.getTime().getByFormat(' HH:mm:ss'));
var Date = new GlideDateTime(today.getDate() + dTimeStrg);
}
Here var Date is not setting correct time on the RITM field.
I want to set as is time for eg it var dTime = 1:30 am it should set 1:30 am ( timezone should also not impact or change time)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2022 12:24 PM
If anyone interested :
Above can be achieved by splitting date and time array and setting the value via current object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 12:22 PM
Try using getDisplayValue() to see if it gets you what you need, but there are many methods to gdt.
var dTime = new GlideDateTime(gr.getValue('u_time'));
dTime.getDisplayValue(); //<< should return the current time depending on where you call it.
Although, you may find the method you are looking for here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2022 12:24 PM
If anyone interested :
Above can be achieved by splitting date and time array and setting the value via current object.