Date Format

Priya123
Tera Contributor

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

9 REPLIES 9

Priya123
Tera Contributor

But does this work right for the format ??

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.

TaiVu_0-1698160942904.png

 

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

Priya123
Tera Contributor

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

@Priya123 

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

 

nimitha
Tera Contributor

Hii priya, please do try the below script.

use the following date format  yyyy-MM-dd HH:mm:ss

Screenshot (228).png

thank you,

Nimitha