cancel
Showing results for 
Search instead for 
Did you mean: 

converting cst time stamp to gmt time

0 Kudos

Hi,

i need a udf for the following requirement

"Source will be Format: 'CCYY-MM-DD-HH.MN.SS.TTTTTTu2019

Example: u20182011-04-18-14.32.13.494000u2019

Destination will be

Fomat: 'YYYY-MM-DDThh:mm:ssZ'

Example: '2002-05-30T09:30:10Z'

Note: The source date will be in the CST timezone and must be converted to the GMT timezone"

thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI praneethrao13 ,

you try to use below code and before change the code as ur requirement.

example for UTS to CST:

====

imports: java.util.Date;java.text.SimpleDateFormat;java.text.DateFormat;

====

Date date = new Date();

DateFormat utcFormat = new SimpleDateFormat("yyyy-MM-dd-HH.mm.ss.SSSS");

DateFormat cstFormat = new SimpleDateFormat("yyyy-MM-dd-HH.mm.ss.SSSS");

TimeZone utcTime = TimeZone.getTimeZone("UTC");

TimeZone cstTime = TimeZone.getTimeZone("CST");

utcFormat.setTimeZone(cstTime);

cstFormat.setTimeZone(utcTime);

return utcFormat.format(date);

thanks,

Answers (1)

Answers (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

simple google it.. you wil get sample java codes and use it as a UDF.