Setting a date/time field to a default constant time with calculated date value

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2018 05:57 AM
Hi,
i need to set a default time 8 pm(us eastern) along with a calculated date value in a date/time field, did anyone faced the same scenario? i'm facing some issues in implementing this.
05-06-2018 08:00 PM
Date --> calculated
time --> constant
Thanks,
date --> calculated
time --> constant
satheesh.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2018 06:49 AM
You can create a GlideDate object for the calculated date and then piece together a GlideDateTime object using setValue().
Here's a script I threw together you can test as a background script:
var gd = new GlideDate();
gd.setValue('2017-05-27');
var gdt = new GlideDateTime();
gdt.setValue(gd + ' 20:00:00'); // Set the time to 8pm
gs.info(gdt.getValue());
The only thing I would keep an eye on when testing is how the Time Zone affects your object. Give this a try and let me know if you run into any trouble.
Dylan