- 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 02:07 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 02:18 PM
you have to update the timezone to GMT on scheduled job and make sure the run frequency covers your needed time.
also your condition looks right
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 02:34 PM
Kindly help me in this point , how to get Lastweek day number / given date of day of week number
var gdt = new GlideDateTime(gs.beginningOfLastWeek());
var last_week = gdt.getDate();
i want to get Lastweek date of the day of week value from 1 to 7. Monday equals 1, Sunday equals 7.
kindly help me in understating , what is diff between these 3.
getDayOfWeek
getDayOfWeekLocalTime
getDayOfWeekUTC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 12:46 PM
Hi Callum,
var Cgdt = new GlideDateTime();
var Cgt = Cgdt.getLocalTime();
gs.info("Hours :" + Cgt.getHourOfDayLocalTime());
Result : 4
var ggdt = new GlideDateTime();
var ggt = ggdt.getLocalTime();
gs.info("Hours cal :" + ggt.getByFormat('HH'));
Result : 12
why it is showing different time here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 08:45 AM
try this
var gdt = new GlideDateTime();
gt = gdt.getTime();
gs.info(gt.getHourLocalTime());