- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 07:54 AM
Hi,
some one please suggest me how to get Hours only from new GlideDateTime()).getLocalTime().
all client systems are running in PST zone.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 01:47 PM
Edited the script
if (gdt.getDayOfWeekUTC() == 2) //Tuesday 2 7AM PST (-7)
{
if (gdtH.getHourOfDayUTC() == 14) {//GMT
email.setSubject("Gentle Reminder for TimeCard Approval of the week starts on " + par1.lastWeek);
email.addAddress("cc", par1.manager_email, par1.manager_name);
template.print('Hi ' + par1.user + ',</br></br>This is a gentle reminder, that the Timecards in Submitted State are overdue, for the week starts on, "' + par1.lastWeek + '" in the system. Kindly Approve or Reject the timecards last by 3PM PST. </br></br>');
template.print('<br/>');
}
}
if (gdt.getDayOfWeekUTC() == 3) //Wednesday 3 1AM = tuesday 2 6PM PST (-7)
{
if (gdtH.getHourOfDayUTC() == 1) { //GMT
email.setSubject("Final Reminder for TimeCard Approval of the week starts on " + par1.lastWeek);
email.addAddress("cc", par1.manager_email, par1.manager_name);
template.print('Hi ' + par1.user + ',</br></br>This is a final reminder, that timecard approval for the below Employees are overdue for the week starts on, "' + par1.lastWeek + '" in the system and needs immediate approval. </br></br>');
template.print('<br/>');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 11:00 AM
Hi Callum,
Thanks for your reply.
Kindly help me here for my understanding.
do we have use " -1 " all time to get right Hours ? or it should be use only get 00 :00 at time time of 00:00 ?
gs.info(gt.getHourOfDayLocalTime() - 1);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 11:47 AM
Response deleted and replaced by separate response below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 12:25 PM
Hi,
i think if we use "-1" always it show one hour less right, so in this case when it will shows 24hrs.
could you please tell me , i think i m missing logic here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 12:34 PM
i tested the method, it is return the right hour . I dont think there is any need of -1
var gt = new GlideTime();
gt.setDisplayValue("23:05:00");
gs.info(gt.getHourOfDayLocalTime()); //23
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 12:44 PM
Hi Pranesh,
i tested your previous script it is returning 0(zero), something wrong here.
var gdt = new GlideDateTime();
gt = gdt.getTime();
gs.info(gt.getHourLocalTime());