- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 07:31 AM
I have a date field that I need to copy to a date time field. Is there a way to do this? Do I need to append the time before I copy?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 07:58 AM
You can copy it directly. By default it will end up with a midnight value on the date from the date field. Example:
var gr = new GlideRecord('table_name');
gr.get('SYS_ID');
gr.my_date_time = gr.getValue('my_date');
gr.update();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 08:20 AM
You are welcome. I've run in to that more times than I care to admit. FWIW, we covered a lot of this in Episode 36 of TechNow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 08:23 AM
Awesome, next thing on my list.
You are a ROCKSTAR!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2017 01:17 PM
Is it possible to use it in Catalog Client Scripts?
var myDate = newValue;
var gdt = new GlideDateTime();
gdt.setDisplayValue(myDate);
var sdate= gdt.getNumericValue();
g_form.setValue("end_date",sdate);
I used On Change client script but doesnt seem to work

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2017 01:20 PM
GlideDateTime is not an available object in client scripts. You would be better served using GlideAjax to do the processing on the server in this case.
Episodes 5, 6, and 33 of TechNow talk about client scripting and GlideAjax.
Docs: Client Scripts
Docs: GlideForm
Docs: GlideAjax
Developer: Client Scripting Technical Best Practices Overview