All pastes #536404 Raw Edit

KAAPA

public java v1 · immutable
·published 2007-06-04 11:31 UTC
rendered paste body
    private void testDates() {                try {                        SimpleDateFormat formatPT = new SimpleDateFormat("yyyy/MM/dd HH:mm zz",new Locale("pt_PT"));            SimpleDateFormat formatES = new SimpleDateFormat("yyyy/MM/dd HH:mm zz",new Locale("es"));                        formatPT.setTimeZone(TimeZone.getTimeZone("Europe/Lisbon"));            formatES.setTimeZone(TimeZone.getTimeZone("Europe/Madrid"));                        SimpleDateFormat parser = new SimpleDateFormat("yyyy/MM/dd HH:mm z");            String dateStr = "2007/06/04 15:00 CET"; // this is 14:00 in Europe/Lisbon                        Date date2 = parser.parse(dateStr);                        logger.info(" Converting string " +  dateStr);            logger.info("  Timezone: " + formatPT.getTimeZone());            logger.info("  In portugal: " + formatPT.format(date2));            logger.info("  In spain: " + formatES.format(date2));                       } catch (ParseException ex) {            logger.error("Error parsing date: " + Util.getExceptionDescription(ex));            ex.printStackTrace();        }                            }