how to convert date /time to ist timezone and also change format?

Servicenow10
Kilo Guru

I am using glidedatetime function and getting the date/time....it is coming in gmt timezone,but i need in ist.

1 ACCEPTED SOLUTION

you can do it like this.

//assuming start is the date/time object as per above code
var st_date = start.getDate();
var st_time = start.getTime();
var start_date = st_time.getByFormat("HH:mm") +" "+ st_date.getByFormat("dd MMMM YYYY");
gs.print(start_date);

Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.

Regards,
Asif
2020 ServiceNow Community MVP

View solution in original post

5 REPLIES 5

Swapnil Soni1
Giga Guru

Hey Dell,

You can try this-

Packages.java.util.TimeZone.getTimeZone("IST"); //sets to IST TO

Packages.java.util.TimeZone.getTimeZone("GMT"); //sets to GMT and check.

 

 Please mark correct or helpful if this works.

Thanks

Swapnil