Date Format
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 10:51 AM
I have a Date in Excel in Date format. the target table has Date /Time format. i tried to append 00:00:00 thro transform script. but its not working as expected. Any better ways to achieve this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2023 07:58 AM
But does this work right for the format ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2023 08:30 AM
Hi @Priya123
Yes it will works as long as the date format in the excel file matching with the date format defined in the Field Map.
Check out my test case.
In the other hands, you can try the below script.
answer = (function transformEntry(source) {
var gdt = new GlideDateTime(source.u_resolved); //replace the date field
var seconds = 6 * 60 * 60;
gdt.addSeconds(seconds);
return gdt.getValue();
})(source);
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2023 11:40 AM
trying this .. i also need to pick one columns date and add 14 days and populate another field thro Transform... oh these dates are getting tricky.. I scripted the nrmal way but some or other error is coming up
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2023 08:36 PM
So let's try this.
var gdt = new GlideDateTime(<field_date>);
gdt.addDaysUTC(14);
gs.log(gdt.getValue()); //user this "gdt.getValue()" to set value for the other field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2023 03:29 AM
Hii priya, please do try the below script.
use the following date format yyyy-MM-dd HH:mm:ss
thank you,
Nimitha