List of usage examples for java.util TimeZone setDefault
public static void setDefault(TimeZone zone)
From source file:es.emergya.Main.java
/** * Starts the app./*from w w w.j a va 2 s . com*/ * * @param args */ public static void main(final String[] args) { try { Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() { @Override public void uncaughtException(final Thread t, final Throwable e) { if (LOG.isTraceEnabled()) { LOG.trace("Excepcion descontrolada en " + t.toString(), e); } else { LOG.error("Excepcion descontrolada en " + t.toString() + " :: " + e.toString(), e); } } }); } catch (Throwable t) { LOG.error(t, t); } try { TimeZone.setDefault(TimeZone.getTimeZone("Europe/Madrid")); //$NON-NLS-1$ new Initializer().run(); } catch (Throwable t) { LOG.error("Fallo el SwingUtilities.invokeLater", t); } }
From source file:org.wso2.ei.businessprocess.utils.migration.MigrationExecutor.java
public static void main(String[] args) { try {/* w ww . j ava 2s . c o m*/ if (System.getProperty("carbon.components.dir.path") != null) { addJarFileUrls(new File(System.getProperty("carbon.components.dir.path"))); } System.out.println("Initialize Migration..."); System.out.println("=========================================="); if (System.getProperty("carbon.home") != null) { System.out.println("Using carbon home directory : " + System.getProperty("carbon.home")); } else { System.out.println("Carbon Home not set, please check the migration tool script !!!!"); } //Get BPS HOME from bin directory BPS_HOME = System.getProperty("carbon.home"); //Load properties initializeDBConnection(); //Set time zone for oracle TimeZone.setDefault(TimeZone.getTimeZone(System.getProperty("user.timezone"))); //Repository Paths String superTenantRepoPath = BPS_HOME + File.separator + "repository" + File.separator + "deployment" + File.separator + "server" + File.separator + "humantasks"; String tenantsRepoPath = BPS_HOME + File.separator + "repository" + File.separator + "tenants"; System.out.println("SUPER TENANT REPOSITORY PATH:" + superTenantRepoPath); System.out.println("TENANTS REPOSITORY PATH:" + tenantsRepoPath); query = new DBQuery(databaseURL); //Check DB schemas Exist if (!versionDBSchemasExists()) { System.out.println("DB Tables are not updated for BPS 3.2.0. Please run the sql script from " + "dbscripts/migration directory and Try Again!!!!"); return; } //Migration for super tenant. migrateSuperTenantHTPacks(superTenantRepoPath); //Migration for tenants. migrateTenantsHTPacks(tenantsRepoPath); System.out.println("Migration Success!!!!"); } catch (Exception ex) { ex.printStackTrace(); System.out.println("ERROR:Migration failed.Try Again!!!!"); } }
From source file:Main.java
public static Date getCurrentUTCTime() { // Set device's time zone to UTC TimeZone.setDefault(TimeZone.getTimeZone("UTC")); Calendar calendar = Calendar.getInstance(); return calendar.getTime(); }
From source file:Main.java
/** * converts time to UTC format//from w w w . j a v a 2 s. c o m */ public static String getHourFormatted(Date createdUTC) { Date dateServer = createdUTC; TimeZone.setDefault(TimeZone.getTimeZone("GMT")); Calendar cal = Calendar.getInstance(TimeZone.getDefault()); Date dateGMT = cal.getTime(); return normalDateFormat(dateServer); }
From source file:Main.java
public static String getDate(long time, String format) { TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai"); TimeZone.setDefault(tz); String datetime = ""; Date date = new Date(time); SimpleDateFormat sdf = new SimpleDateFormat(format); datetime = sdf.format(date);/*from w w w . j a v a 2s . c o m*/ return datetime; }
From source file:uk.gov.hscic.common.util.DateFormatter.java
public static Date toDate(final String input) { if (input == null) { return null; }/*from w w w .ja va 2 s .co m*/ TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); try { return DateUtils.parseDate(input, "yyyy-MM-dd", "dd-MM-yyyy", "yyyy-MM-dd'T'HH:mm:ss", "yyyy-MM-dd'T'HH:mm:ss'Z'", "yyyy-MM-dd'T'HH:mm:ss.SSS", "yyyy-MM-dd'T'HH:mm:ss.SSSX", "yyyy-MM-dd'T'HH:mm:ss.SSSXX", "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", "HH:mm:ss", "yyyy.MM.dd", "yyyyMMdd"); } catch (final ParseException ignore) { return null; } }
From source file:org.rippleosi.common.util.DateFormatter.java
public static Date toDate(String input) { if (input == null) { return null; }//from www. jav a 2 s . c o m TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); try { return DateUtils.parseDate(input, "yyyy-MM-dd", "dd-MM-yyyy", "yyyy-MM-dd'T'HH:mm:ss", "yyyy-MM-dd'T'HH:mm:ss'Z'", "yyyy-MM-dd'T'HH:mm:ss.SSS", "yyyy-MM-dd'T'HH:mm:ss.SSSX", "yyyy-MM-dd'T'HH:mm:ss.SSSXX", "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", "HH:mm:ss", "yyyy.MM.dd", "yyyyMMdd"); } catch (ParseException ignore) { return null; } }
From source file:com.vstar.lib.utils.UIUtils.java
public static boolean isSameDay(long time1, long time2) { TimeZone.setDefault(TimeZone.getDefault()); Calendar cal1 = Calendar.getInstance(); Calendar cal2 = Calendar.getInstance(); cal1.setTimeInMillis(time1);//from w ww .ja v a 2 s .c o m cal2.setTimeInMillis(time2); return cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR); }
From source file:com.alliander.osgp.acceptancetests.ScopedGivWenZenForSlim.java
private static InstantiationStrategy autowireStepDefinitionClassesWithSpring() { rootContext = new AnnotationConfigApplicationContext(); // Force local timezone to UTC (like platform) DateTimeZone.setDefault(DateTimeZone.UTC); TimeZone.setDefault(TimeZone.getTimeZone("UTC")); // Set loglevel to INFO (instead of DEBUG) final Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); root.setLevel(Level.INFO);//from w ww.ja va2 s. co m rootContext.register(TestApplicationContext.class); try { rootContext.refresh(); } catch (final Exception e) { // just for debugging... throw e; } return new SpringInstantiationStrategy(rootContext); }
From source file:com.vokal.async_image_cache.UIUtils.java
public static boolean isSameDay(long time1, long time2) { TimeZone.setDefault(DEFAULT_TIME_ZONE); Calendar cal1 = Calendar.getInstance(); Calendar cal2 = Calendar.getInstance(); cal1.setTimeInMillis(time1);/*from w ww. j av a2 s.co m*/ cal2.setTimeInMillis(time2); return cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR); }