List of usage examples for java.util TimeZone getID
public String getID()
From source file:core.module.Module.java
public void setTimeZone(TimeZone tz) { this.timeZone = tz.getID(); }
From source file:util.CalendarExporter.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) private long pushAppointmentsToCalender(final LvPlanEntries entry) { try {// ww w . j a v a 2 s . c om if (ics) { ContentValues eventValues = new ContentValues(); //The _ID of the calendar the event belongs to --> Primary == 1 eventValues.put("calendar_id", calendarID); eventValues.put(CalendarContract.Events.TITLE, entry.getSummary()); eventValues.put(CalendarContract.Events.DESCRIPTION, MARKER); //used to find again !?!? eventValues.put(CalendarContract.Events.EVENT_LOCATION, entry.getLocation()); eventValues.put(CalendarContract.Events.DTSTART, entry.getFromDate().getTimeInMillis()); //The time the event starts in UTC millis since epoch eventValues.put(CalendarContract.Events.DTEND, entry.getToDate().getTimeInMillis()); //eventValues.put("eventStatus", status); //eventValues.put(CalendarContract.Events.VISIBLE, 0); // visibility to default (0), // confidential (1), private // (2), or public (3): //eventValues.put("transparency", 0); // You can control whether // an event consumes time // opaque (0) or transparent // (1). eventValues.put(CalendarContract.Events.HAS_ALARM, 0); // 0 for false, 1 for true TimeZone timeZone = TimeZone.getDefault(); eventValues.put(CalendarContract.Events.EVENT_TIMEZONE, timeZone.getID()); Uri uri = contentResolver.insert(CalendarContract.Events.CONTENT_URI, eventValues); return Long.parseLong(uri.getLastPathSegment()); } else { ContentValues eventValues = new ContentValues(); //The _ID of the calendar the event belongs to --> Primary == 1 eventValues.put("calendar_id", calendarID); eventValues.put("title", entry.getSummary()); eventValues.put("description", MARKER); //used to find again !?!? eventValues.put("eventLocation", entry.getLocation()); eventValues.put("dtstart", entry.getFromDate().getTimeInMillis()); //The time the event starts in UTC millis since epoch eventValues.put("dtend", entry.getToDate().getTimeInMillis()); //eventValues.put("eventStatus", status); eventValues.put("visibility", 0); // visibility to default (0), // confidential (1), private // (2), or public (3): //eventValues.put("transparency", 0); // You can control whether // an event consumes time // opaque (0) or transparent // (1). eventValues.put("hasAlarm", 0); // 0 for false, 1 for true Uri eventUri = appContext.getContentResolver().insert(Uri.parse(URI_CALENDAR), eventValues); long eventID = Long.parseLong(eventUri.getLastPathSegment()); return eventID; } } catch (Exception ex) { Log.d("Add Event", "Error", ex); return -1; } }
From source file:BaseProperties.java
/** * Set <code>TimeZone</code> object. *//*from ww w . j av a 2 s .c o m*/ public void setProperty(final String key, final TimeZone val) { setProperty(key, val.getID()); }
From source file:org.ngrinder.home.controller.HomeController.java
private void setLoginPageDate(ModelMap model) { TimeZone defaultTime = TimeZone.getDefault(); model.addAttribute("timezones", timeZones); model.addAttribute("defaultTime", defaultTime.getID()); }
From source file:org.nanoframework.commons.util.StringUtils.java
/** * Parse the given {@code timeZoneString} value into a {@link TimeZone}. * @param timeZoneString the time zone {@code String}, following {@link TimeZone#getTimeZone(String)} * but throwing {@link IllegalArgumentException} in case of an invalid time zone specification * @return a corresponding {@link TimeZone} instance * @throws IllegalArgumentException in case of an invalid time zone specification *//*from w ww.j a va 2 s. co m*/ public static TimeZone parseTimeZoneString(String timeZoneString) { TimeZone timeZone = TimeZone.getTimeZone(timeZoneString); if ("GMT".equals(timeZone.getID()) && !timeZoneString.startsWith("GMT")) { // We don't want that GMT fallback... throw new IllegalArgumentException("Invalid time zone specification '" + timeZoneString + '\''); } return timeZone; }
From source file:ch.cyberduck.core.ftp.FTPParserFactory.java
private CompositeFileEntryParser createNTFTPEntryParser(final TimeZone timezone) { return new CompositeFileEntryParser(Arrays.asList(new NTFTPEntryParser() { @Override//from ww w .j ava 2 s . co m public FTPClientConfig getDefaultConfiguration() { final FTPClientConfig config = super.getDefaultConfiguration(); config.setServerTimeZoneId(timezone.getID()); return config; } }, this.createUnixFTPEntryParser(timezone))); }
From source file:org.kalypso.core.KalypsoCorePlugin.java
/** * Gets the kalypso timezone (to be used to display any dates in the UI).<br> * The timezone is set in the user-preferences. If the preference is not set, the value of the system property * 'kalypso.timezone' will be used, or, if not set, the system timezone (see {@link TimeZone#getDefault()}). <br> * The user preferences can explicitly be set to: * <ul>/*from w w w . ja v a 2 s .c o m*/ * <li>OS_TIMEZONE: {@link TimeZone#getDefault() is always used}</li> * <li>CONFIG_TIMEZONE: timezone definition from config.ini (kalypso.timezone) is used (defaults to system timezone if not set)</li> * </ul> */ public TimeZone getTimeZone() { final TimeZone timezone = getInternalTimeZone(); /** we want to get rid of daylight saving times and only support GMT based time zones! */ final String identifier = timezone.getID(); if (!StringUtils.containsIgnoreCase(identifier, "gmt")) //$NON-NLS-1$ { final Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.MONTH, 0); // get offset from winter daylight saving time! final int offset = timezone.getOffset(calendar.getTimeInMillis()); return TimeZone.getTimeZone(String.format("GMT%+d", offset)); //$NON-NLS-1$ } return timezone; }
From source file:ch.cyberduck.core.ftp.FTPParserFactory.java
private CompositeFileEntryParser createOS2FTPEntryParser(final TimeZone timezone) { return new CompositeFileEntryParser(Arrays.asList(new OS2FTPEntryParser() { @Override/*from w w w. j av a 2s .c o m*/ protected FTPClientConfig getDefaultConfiguration() { final FTPClientConfig config = super.getDefaultConfiguration(); config.setServerTimeZoneId(timezone.getID()); return config; } })); }
From source file:ch.cyberduck.core.ftp.FTPParserFactory.java
private CompositeFileEntryParser createMVSEntryParser(final TimeZone timezone) { return new CompositeFileEntryParser(Arrays.asList(new MVSFTPEntryParser() { @Override/*from w ww . j a v a 2 s .c o m*/ protected FTPClientConfig getDefaultConfiguration() { final FTPClientConfig config = super.getDefaultConfiguration(); config.setServerTimeZoneId(timezone.getID()); return config; } })); }
From source file:ch.cyberduck.core.ftp.FTPParserFactory.java
private CompositeFileEntryParser createOS400FTPEntryParser(final TimeZone timezone) { return new CompositeFileEntryParser(Arrays.asList(new OS400FTPEntryParser() { @Override//from www . ja v a 2s .co m protected FTPClientConfig getDefaultConfiguration() { final FTPClientConfig config = super.getDefaultConfiguration(); config.setServerTimeZoneId(timezone.getID()); return config; } }, this.createUnixFTPEntryParser(timezone))); }