- 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 01:35 PM
var gdt = new GlideDateTime();
var gt = gdt.getTime();
gs.info("DayOf Test:" + gt.getHourOfDayLocalTime());
returning PST time 13Hours
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 01:40 PM
To avoid all confusion, convert the pst time into gmt and use
gt.getHourOfDayUTC()
f (gdt.getDayOfWeekLocalTime() == 2) //Tuesday 2 7AM PST , 18 PM PST
{
if (gdtH.getHourOfDayLocalTime() == 7) { //GMT - 14
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 (gdtH.getHourOfDayLocalTime() == 18) { //GMT - 1 , wednesday 3
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 01:43 PM
i Agreed with you in this point.
Kindly suggest me Hours format, always it has to use system timezone only, take system timezone hours only.
system timezone might be anything (iST or CST or GMT or PST or UTC or MTC ), but always it has to use Sysem timezone.
kindly help me this way.
- 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 01:50 PM
i have two trigger points on Tuesday only 7AM morning , 6PM evening