/ Published in: Java
                    
                                        
Converts a date/time from one timezone to another.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
/*
* Converts time from sourceTZ TimeZone to destTZ TimeZone.
*
* @return converted time, or the original time, in case the datetime could not be parsed
*
*/
{
Date specifiedTime;
try {
if (sourceTZ != null)
else
specifiedTime = sdf.parse(time);
}
try {
//
return time;
}
}
// switch timezone
if (destTZ != null)
else
return sdf.format(specifiedTime);
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                