on 10-05-2015 8:10 PM
Hi All,
I am working on Proxy to SOAP synchronous interface. We are receiving a timestamp value in response as 2015-09-30T06:18:08-05:00.
Our requirement is to convert the incoming timestamp (2015-09-30T06:18:08-05:00) to CST timezone (2015-09-30T11:18:08).
Please help me with UDF to get the same.
Thanks,
Nida Fatima
Hi Nida
I am a bit confused with you requirement when you say date/time "2015-09-30T06:18:08-05:00" this means it is already in CST, so if you convert this into CST the output will be "2015-09-30T06:18:08".
But you mentioned output should be "2015-09-30T11:18:08" which will be UTC according to above CST date.
Also Timezones will not come : so your it will be "-0500" not "-05:00" .
But still try this below code and let me know if this works.
DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
DateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
try{
Date date = inputFormat.parse(inTimeStr);
outputFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
return outputFormat.format(date);
}catch(Exception e){
return "you error";
}
Note: add "java.text.*" in import section.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.