The code worked because the format specified in the SimpleDateFormat didnt support Timezone information. You need to add "z" at the end of the
string passed to SimpleDateFormat for timezone information to be shown.
Please start a new
thread for a new question. (There should be some API available, not sure if its in JDK, to get the correct time from the Internet).