- 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 12:59 PM
this should clear your all doubts
var gdt = new GlideDateTime();
gs.info(gdt); //UTC
gs.info(gdt.getDisplayValue()); //local instance time
gt = gdt.getTime();
gs.info(gt.getHourLocalTime()); // The hours using the local time zone. The number of hours is based on a 12 hour clock. Noon and midnight are represented by 0, not 12.
gs.info(gt.getHourOfDayLocalTime()); //The hours using the local time zone. The number of hours is based on a 24 hour clock.
gs.info(gt.getHourOfDayUTC()); //The hours using the UTC time zone. The number of hours is based
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 01:06 PM
Thanks You !.
Kindly help me
Local time means : user location time ( users might be from various places right , will it take location time ? ) or instance time ? or User profile Timezone time
var gdt = new GlideDateTime();
var gt = gdt.getTime();
gs.info("DayOf Test:" + gt.getHourOfDayLocalTime()+"-----"+gt);
Output : DayOf Test:13-----1970-01-01 21:06:47
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 01:11 PM
it will be instance time which will be User profile Timezone time
var gdt = new GlideDateTime();
var gt = gdt.getTime();
gs.info("DayOf Test:" + gt.getHourOfDayLocalTime()+"-----"+gt.getDisplayValue());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 01:24 PM
under system properties , we didn't mentioned any timeZone.
my profile TimeZone is "IST " -india
i just confused here, which timezone it is considering here.
My requirement is : as per PST 7AM need to trigger one condition , 18PM need to trigger another if-condition as per PST only
if (gdt.getDayOfWeekLocalTime() == 2) //Tuesday 2 7AM PST , 18 PM PST
{
if (gdtH.getHourOfDayLocalTime() == 7) {
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) {
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:31 PM
if your profile timezone is IST, then the local timetime will be IST
by default, local timezone is PST
Output : DayOf Test:13-----13:14:23