Skip to Content
Author's profile photo Gaurav Kant

Date Time conversion to different timezone and desired formats

In this blog, i will outline how to use UDF as date formatter and how to convert it to different time zone. Here, i have taken a requirement from scn and implemented the same.

Here, in the below code we are getting date as String and converting it to date type. And DateFormat class is used to convert incoming date to required date format and required time zone as well by using set and get timezone.

UDF Code:


String D=var1;

DateFormat converter = new SimpleDateFormat(“dd-MM-yyyy”);

Date dt=(Date)converter.parse(D);

DateFormat converter1 = new SimpleDateFormat(“yyyy-MM-dd’T’HH:mm:ssZ:00”);



return D;


catch(ParseException e)




return null;

UDF Screenshot:




In the above code we have used a date format and timezone. you can use different time zone and format as per your requirement.


Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Jigar Nalvaya
      Jigar Nalvaya

      The code is working fine for converting to AEST or PST or other timezones.

      But when I am trying to convert the time to UTC or GMT it's not working. It is giving back the input time in output.

      Please help.