Example usage for java.util TimeZone getID

List of usage examples for java.util TimeZone getID

Introduction

In this page you can find the example usage for java.util TimeZone getID.

Prototype

public String getID() 

Source Link

Document

Gets the ID of this time zone.

Usage

From source file:lucee.commons.i18n.FormatUtil.java

/**
 * CFML Supported LS Formats/*from  w w w  . j a  v a 2s .com*/
 * @param locale
 * @param tz
 * @param lenient
 * @return
 */
public static DateFormat[] getCFMLFormats(TimeZone tz, boolean lenient) {
    String id = "cfml-" + Locale.ENGLISH.hashCode() + "-" + tz.getID() + "-" + lenient;
    DateFormat[] df = formats.get(id);
    if (df == null) {
        df = new SimpleDateFormat[] { new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH),
                new SimpleDateFormat("MMMM dd, yyyy HH:mm:ss a zzz", Locale.ENGLISH),
                new SimpleDateFormat("MMM dd, yyyy HH:mm:ss a", Locale.ENGLISH),
                new SimpleDateFormat("MMM dd, yyyy HH:mm:ss", Locale.ENGLISH),
                new SimpleDateFormat("MMMM d yyyy HH:mm:ssZ", Locale.ENGLISH),
                new SimpleDateFormat("MMMM d yyyy HH:mm:ss", Locale.ENGLISH),
                new SimpleDateFormat("MMMM d yyyy HH:mm", Locale.ENGLISH),
                new SimpleDateFormat("EEE, MMM dd, yyyy HH:mm:ssZ", Locale.ENGLISH),
                new SimpleDateFormat("EEE, MMM dd, yyyy HH:mm:ss", Locale.ENGLISH),
                new SimpleDateFormat("EEEE, MMMM dd, yyyy H:mm:ss a zzz", Locale.ENGLISH),
                new SimpleDateFormat("dd-MMM-yy HH:mm a", Locale.ENGLISH),
                new SimpleDateFormat("dd-MMMM-yy HH:mm a", Locale.ENGLISH),
                new SimpleDateFormat("EE, dd-MMM-yyyy HH:mm:ss zz", Locale.ENGLISH),
                new SimpleDateFormat("EE, dd MMM yyyy HH:mm:ss zz", Locale.ENGLISH),
                new SimpleDateFormat("EEE d, MMM yyyy HH:mm:ss zz", Locale.ENGLISH),
                new SimpleDateFormat("dd-MMM-yyyy", Locale.ENGLISH),
                new SimpleDateFormat("MMMM, dd yyyy HH:mm:ssZ", Locale.ENGLISH),
                new SimpleDateFormat("MMMM, dd yyyy HH:mm:ss", Locale.ENGLISH),
                new SimpleDateFormat("yyyy/MM/dd HH:mm:ss zz", Locale.ENGLISH),
                new SimpleDateFormat("dd MMM yyyy HH:mm:ss zz", Locale.ENGLISH),
                new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss 'GMT'ZZ (z)", Locale.ENGLISH),
                new SimpleDateFormat("dd MMM, yyyy HH:mm:ss", Locale.ENGLISH)
                //,new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss",Locale.ENGLISH)
        };

        for (int i = 0; i < df.length; i++) {
            df[i].setLenient(lenient);
            df[i].setTimeZone(tz);
        }
        formats.put(id, df);
    }
    return df;
}

From source file:org.apache.falcon.util.DateUtil.java

/**
 * Returns the {@link java.util.TimeZone} for the given timezone ID.
 *
 * @param tzId timezone ID.//from w  ww  .  j av  a 2  s.c  om
 * @return  the {@link java.util.TimeZone} for the given timezone ID.
 */
public static TimeZone getTimeZone(String tzId) {
    if (tzId == null) {
        throw new IllegalArgumentException("Timezone cannot be null");
    }
    tzId = handleGMTOffsetTZNames(tzId); // account for GMT-####
    TimeZone tz = TimeZone.getTimeZone(tzId);
    // If these are not equal, it means that the tzId is not valid (invalid tzId's return GMT)
    if (!tz.getID().equals(tzId)) {
        throw new IllegalArgumentException("Invalid TimeZone: " + tzId);
    }
    return tz;
}

From source file:alfio.model.modification.support.LocationDescriptor.java

public static LocationDescriptor fromGeoData(Pair<String, String> coordinates, TimeZone timeZone,
        Map<ConfigurationKeys, Optional<String>> geoConf) {
    Map<String, String> params = new HashMap<>();
    String lat = coordinates.getLeft();
    String lng = coordinates.getRight();
    params.put("latitude", lat);
    params.put("longitude", lng);

    return new LocationDescriptor(timeZone.getID(), coordinates.getLeft(), coordinates.getRight(),
            getMapUrl(lat, lng, geoConf));
}

From source file:net.solarnetwork.domain.BasicLocation.java

/**
 * Return a new SolarLocation with normalized values from another Location.
 * /* www  .ja v  a2 s  .  c  o  m*/
 * @param loc
 *        the location to normalize
 * @return the normalized location
 */
public static BasicLocation normalizedLocation(Location loc) {
    assert loc != null;
    BasicLocation norm = new BasicLocation();
    if (loc.getName() != null) {
        String name = loc.getName().trim();
        if (name.length() > 0) {
            norm.setName(name);
        }
    }
    if (loc.getCountry() != null && loc.getCountry().length() >= 2) {
        String country = loc.getCountry();
        if (country.length() > 2) {
            country = country.substring(0, 2);
        }
        norm.setCountry(country.toUpperCase());
    }
    if (loc.getTimeZoneId() != null) {
        TimeZone tz = TimeZone.getTimeZone(loc.getTimeZoneId());
        if (tz != null) {
            norm.setTimeZoneId(tz.getID());
        }
    }
    if (loc.getRegion() != null) {
        String region = loc.getRegion().trim();
        if (region.length() > 0) {
            norm.setRegion(region);
        }
    }
    if (loc.getStateOrProvince() != null) {
        String state = loc.getStateOrProvince().trim();
        if (state.length() > 0) {
            norm.setStateOrProvince(state);
        }
    }
    if (loc.getLocality() != null) {
        String locality = loc.getLocality().trim();
        if (locality.length() > 0) {
            norm.setLocality(locality);
        }
    }
    if (loc.getPostalCode() != null) {
        String postalCode = loc.getPostalCode().trim().toUpperCase();
        if (postalCode.length() > 0) {
            norm.setPostalCode(postalCode);
        }
    }
    if (loc.getStreet() != null) {
        String street = loc.getStreet().trim();
        if (street.length() > 0) {
            norm.setStreet(street);
        }
    }
    norm.setLatitude(loc.getLatitude());
    norm.setLongitude(loc.getLongitude());
    norm.setElevation(loc.getElevation());
    return norm;
}

From source file:net.antidot.sql.model.core.SQLConnector.java

/**
 * Convert timeZone into a valid xsd:dateTime format.
 * // w  w w. ja  v  a 2  s. c  o m
 * @param tz
 * @return
 */
public static String timeZoneToStr(TimeZone tz) {
    if (tz == null)
        return null;
    // Exception if timeZone is UTC
    if (tz.getID().equals("UTC"))
        return "Z";
    // Convert timeZone into a valid xsd:dateTime format
    SimpleDateFormat df = new SimpleDateFormat("Z");
    df.setTimeZone(tz);
    String result = df.format(new Date());
    // xsd:dateTime requires a ":" in timeZone
    result = result.substring(0, result.length() - 2) + ":" + result.substring(result.length() - 2);
    return result;
}

From source file:org.kalypso.ogc.sensor.tableview.TableViewUtils.java

/**
 * Builds the xml binding object using the given the table view template
 * /* w w  w  .  j a  va  2s .  c  o m*/
 * @param context
 *          If non-<code>null</code>, all data-pathes (href to observations) will be resolved as relative pathes
 *          against this context. Only the relative pathes will be written into the xml.<br>
 *          Set to <code>null</code>, if the pathes should be written as absolute pathes.
 * @return xml binding object (ready for marshalling for instance)
 */
public static Obstableview buildTableTemplateXML(final TableView template, final IContainer context) {
    final Obstableview xmlTemplate = OTT_OF.createObstableview();

    xmlTemplate.setFeatures(StringUtils.join(template.getEnabledFeatures(), ';'));

    xmlTemplate.setAlphaSort(template.isAlphaSort());

    // rendering rules
    final Rules xmlRulesType = OTT_OF.createObstableviewRules();
    xmlTemplate.setRules(xmlRulesType);
    final List<TypeRenderingRule> xmlRules = xmlRulesType.getRenderingrule();

    // only set timezone if not default one
    final TimeZone timezone = template.getTimezone();
    if (timezone != null)
        xmlTemplate.setTimezone(timezone.getID());

    final List<RenderingRule> rules = template.getRules().getRules();
    for (final RenderingRule rule : rules) {
        final TypeRenderingRule xmlRule = OTT_OF.createTypeRenderingRule();
        xmlRule.setMask(rule.getMask());
        if (rule.getForegroundColor() != null)
            xmlRule.setForegroundcolor(StringUtilities.colorToString(rule.getForegroundColor()));
        if (rule.getBackgroundColor() != null)
            xmlRule.setBackgroundcolor(StringUtilities.colorToString(rule.getBackgroundColor()));
        if (rule.getFont() != null)
            xmlRule.setFont(StringUtilities.fontToString(rule.getFont()));
        xmlRule.setTooltip(rule.getTooltipText());

        xmlRules.add(xmlRule);
    }

    // themes
    final List<TypeObservation> xmlObsList = xmlTemplate.getObservation();

    int colCount = 0;

    final Map<IObservation, ArrayList<ObsViewItem>> map = ObsView.mapItems(template.getItems());

    for (final Entry<IObservation, ArrayList<ObsViewItem>> entry : map.entrySet()) {
        final IObservation obs = entry.getKey();
        if (obs == null)
            continue;

        final TypeObservation xmlObs = OTT_OF.createTypeObservation();

        final String href = obs.getHref();
        final String xmlHref = ObsViewUtils.makeRelativ(context, href);
        xmlObs.setHref(xmlHref);

        xmlObs.setLinktype("zml"); //$NON-NLS-1$

        xmlObsList.add(xmlObs);

        // columns
        final List<TypeColumn> xmlColumns = xmlObs.getColumn();

        final List<ObsViewItem> columns = entry.getValue();
        for (final ObsViewItem obsViewItem : columns) {
            final TableViewColumn col = (TableViewColumn) obsViewItem;

            colCount++;
            final TypeColumn xmlCol = OTT_OF.createTypeColumn();
            xmlCol.setAxis(col.getValueAxis().getName());
            xmlCol.setEditable(col.isEditable());
            xmlCol.setId("c" + String.valueOf(colCount)); //$NON-NLS-1$
            xmlCol.setName(col.getName());
            xmlCol.setWidth(col.getWidth());
            xmlCol.setFormat(col.getFormat());

            xmlColumns.add(xmlCol);
        }
    }

    return xmlTemplate;
}

From source file:com.sirma.itt.seip.time.ISO8601DateFormat.java

/**
 * Parse date from ISO formatted string.
 *
 * @param isoDate//www .j  a v  a 2s .c  om
 *            ISO string to parse
 * @return the date
 */
public static Date parse(String isoDate) {
    if (StringUtils.isBlank(isoDate)) {
        return null;
    }
    Date parsed = null;

    try {
        int offset = 0;

        // extract year
        int year = Integer.parseInt(isoDate.substring(offset, offset += 4));
        if (isoDate.charAt(offset) != '-') {
            throw new IndexOutOfBoundsException(EXPECTED_CHARACTER_BUT_FOUND + isoDate.charAt(offset));
        }

        // extract month
        int month = Integer.parseInt(isoDate.substring(offset += 1, offset += 2));
        if (isoDate.charAt(offset) != '-') {
            throw new IndexOutOfBoundsException(EXPECTED_CHARACTER_BUT_FOUND + isoDate.charAt(offset));
        }

        // extract day
        int day = Integer.parseInt(isoDate.substring(offset += 1, offset += 2));
        if (isoDate.charAt(offset) != 'T') {
            throw new IndexOutOfBoundsException("Expected T character but found " + isoDate.charAt(offset));
        }

        // extract hours, minutes, seconds and milliseconds
        int hour = Integer.parseInt(isoDate.substring(offset += 1, offset += 2));
        if (isoDate.charAt(offset) != ':') {
            throw new IndexOutOfBoundsException(EXPECTED_CHARACTER_BUT_FOUND2 + isoDate.charAt(offset));
        }
        int minutes = Integer.parseInt(isoDate.substring(offset += 1, offset += 2));
        if (isoDate.charAt(offset) != ':') {
            throw new IndexOutOfBoundsException(EXPECTED_CHARACTER_BUT_FOUND2 + isoDate.charAt(offset));
        }
        int seconds = Integer.parseInt(isoDate.substring(offset += 1, offset += 2));
        int milliseconds = 0;
        if (isoDate.charAt(offset) == '.') {
            // ALF-3803 bug fix, milliseconds are optional
            milliseconds = Integer.parseInt(isoDate.substring(offset += 1, offset += 3));
        }

        // extract timezone
        String timezoneId;
        char timezoneIndicator = isoDate.charAt(offset);
        if (timezoneIndicator == '+' || timezoneIndicator == '-') {
            timezoneId = "GMT" + isoDate.substring(offset);
        } else if (timezoneIndicator == 'Z') {
            timezoneId = "GMT";
        } else {
            throw new IndexOutOfBoundsException("Invalid time zone indicator " + timezoneIndicator);
        }

        // Get the timezone
        Map<String, TimeZone> timezoneMap = TIMEZONES.get();
        if (timezoneMap == null) {
            timezoneMap = new HashMap<>(3);
            TIMEZONES.set(timezoneMap);
        }
        TimeZone timezone = timezoneMap.get(timezoneId);
        if (timezone == null) {
            timezone = TimeZone.getTimeZone(timezoneId);
            timezoneMap.put(timezoneId, timezone);
        }
        if (!timezone.getID().equals(timezoneId)) {
            throw new IndexOutOfBoundsException();
        }

        // initialize Calendar object#
        // Note: always de-serialise from Gregorian Calendar
        Calendar calendar = new GregorianCalendar(timezone);
        calendar.setLenient(false);
        calendar.set(Calendar.YEAR, year);
        calendar.set(Calendar.MONTH, month - 1);
        calendar.set(Calendar.DAY_OF_MONTH, day);
        calendar.set(Calendar.HOUR_OF_DAY, hour);
        calendar.set(Calendar.MINUTE, minutes);
        calendar.set(Calendar.SECOND, seconds);
        calendar.set(Calendar.MILLISECOND, milliseconds);

        // extract the date
        parsed = calendar.getTime();
    } catch (IndexOutOfBoundsException e) {
        throw new EmfRuntimeException(FAILED_TO_PARSE_DATE + isoDate, e);
    } catch (NumberFormatException e) {
        throw new EmfRuntimeException(FAILED_TO_PARSE_DATE + isoDate, e);
    } catch (IllegalArgumentException e) {
        throw new EmfRuntimeException(FAILED_TO_PARSE_DATE + isoDate, e);
    }

    return parsed;
}

From source file:com.sirma.itt.emf.time.ISO8601DateFormat.java

/**
 * Parse date from ISO formatted string.
 * // w  w w .j  a va  2s .  c  om
 * @param isoDate
 *            ISO string to parse
 * @return the date
 */
public static Date parse(String isoDate) {
    if (StringUtils.isBlank(isoDate)) {
        return null;
    }
    Date parsed = null;

    try {
        int offset = 0;

        // extract year
        int year = Integer.parseInt(isoDate.substring(offset, offset += 4));
        if (isoDate.charAt(offset) != '-') {
            throw new IndexOutOfBoundsException("Expected - character but found " + isoDate.charAt(offset));
        }

        // extract month
        int month = Integer.parseInt(isoDate.substring(offset += 1, offset += 2));
        if (isoDate.charAt(offset) != '-') {
            throw new IndexOutOfBoundsException("Expected - character but found " + isoDate.charAt(offset));
        }

        // extract day
        int day = Integer.parseInt(isoDate.substring(offset += 1, offset += 2));
        if (isoDate.charAt(offset) != 'T') {
            throw new IndexOutOfBoundsException("Expected T character but found " + isoDate.charAt(offset));
        }

        // extract hours, minutes, seconds and milliseconds
        int hour = Integer.parseInt(isoDate.substring(offset += 1, offset += 2));
        if (isoDate.charAt(offset) != ':') {
            throw new IndexOutOfBoundsException("Expected : character but found " + isoDate.charAt(offset));
        }
        int minutes = Integer.parseInt(isoDate.substring(offset += 1, offset += 2));
        if (isoDate.charAt(offset) != ':') {
            throw new IndexOutOfBoundsException("Expected : character but found " + isoDate.charAt(offset));
        }
        int seconds = Integer.parseInt(isoDate.substring(offset += 1, offset += 2));
        int milliseconds = 0;
        if (isoDate.charAt(offset) == '.') {
            // ALF-3803 bug fix, milliseconds are optional
            milliseconds = Integer.parseInt(isoDate.substring(offset += 1, offset += 3));
        }

        // extract timezone
        String timezoneId;
        char timezoneIndicator = isoDate.charAt(offset);
        if ((timezoneIndicator == '+') || (timezoneIndicator == '-')) {
            timezoneId = "GMT" + isoDate.substring(offset);
        } else if (timezoneIndicator == 'Z') {
            timezoneId = "GMT";
        } else {
            throw new IndexOutOfBoundsException("Invalid time zone indicator " + timezoneIndicator);
        }

        // Get the timezone
        Map<String, TimeZone> timezoneMap = timezones.get();
        if (timezoneMap == null) {
            timezoneMap = new HashMap<>(3);
            timezones.set(timezoneMap);
        }
        TimeZone timezone = timezoneMap.get(timezoneId);
        if (timezone == null) {
            timezone = TimeZone.getTimeZone(timezoneId);
            timezoneMap.put(timezoneId, timezone);
        }
        if (!timezone.getID().equals(timezoneId)) {
            throw new IndexOutOfBoundsException();
        }

        // initialize Calendar object#
        // Note: always de-serialise from Gregorian Calendar
        Calendar calendar = new GregorianCalendar(timezone);
        calendar.setLenient(false);
        calendar.set(Calendar.YEAR, year);
        calendar.set(Calendar.MONTH, month - 1);
        calendar.set(Calendar.DAY_OF_MONTH, day);
        calendar.set(Calendar.HOUR_OF_DAY, hour);
        calendar.set(Calendar.MINUTE, minutes);
        calendar.set(Calendar.SECOND, seconds);
        calendar.set(Calendar.MILLISECOND, milliseconds);

        // extract the date
        parsed = calendar.getTime();
    } catch (IndexOutOfBoundsException e) {
        throw new EmfRuntimeException("Failed to parse date " + isoDate, e);
    } catch (NumberFormatException e) {
        throw new EmfRuntimeException("Failed to parse date " + isoDate, e);
    } catch (IllegalArgumentException e) {
        throw new EmfRuntimeException("Failed to parse date " + isoDate, e);
    }

    return parsed;
}

From source file:org.kalypso.ogc.sensor.diagview.DiagViewUtils.java

/**
 * Builds the xml binding object using the given diagram view template
 * //  w  w  w.j  a  v a 2s.c  om
 * @return xml binding object (ready for marshalling for instance)
 */
public static Obsdiagview buildDiagramTemplateXML(final DiagView view, final IContainer context) {
    final Obsdiagview xmlTemplate = ODT_OF.createObsdiagview();

    final Legend xmlLegend = ODT_OF.createObsdiagviewLegend();
    xmlLegend.setTitle(view.getLegendName());
    xmlLegend.setVisible(view.isShowLegend());

    xmlTemplate.setLegend(xmlLegend);
    xmlTemplate.setTitle(view.getTitle());
    xmlTemplate.setTitleFormat(view.getTitleFormat());

    // only set timezone if defined
    final TimeZone timezone = view.getTimezone();
    if (timezone != null)
        xmlTemplate.setTimezone(timezone.getID());

    final List<TypeAxis> xmlAxes = xmlTemplate.getAxis();

    final DiagramAxis[] diagramAxes = view.getDiagramAxes();
    for (final DiagramAxis axis : diagramAxes) {
        final TypeAxis xmlAxis = ODT_OF.createTypeAxis();
        xmlAxis.setDatatype(axis.getDataType());
        xmlAxis.setDirection(TypeDirection.fromValue(axis.getDirection()));
        xmlAxis.setId(axis.getIdentifier());
        xmlAxis.setInverted(axis.isInverted());
        xmlAxis.setLabel(axis.getLabel());
        xmlAxis.setPosition(TypePosition.fromValue(axis.getPosition()));
        xmlAxis.setUnit(axis.getUnit());

        xmlAxes.add(xmlAxis);
    }

    xmlTemplate.setFeatures(StringUtils.join(view.getEnabledFeatures(), ';'));

    int ixCurve = 1;

    final List<TypeObservation> xmlThemes = xmlTemplate.getObservation();
    final Map<IObservation, ArrayList<ObsViewItem>> map = ObsView.mapItems(view.getItems());
    for (final Entry<IObservation, ArrayList<ObsViewItem>> entry : map.entrySet()) {
        final IObservation obs = entry.getKey();
        if (obs == null)
            continue;

        final TypeObservation xmlTheme = ODT_OF.createTypeObservation();

        final String href = obs.getHref();
        final String xmlHref = ObsViewUtils.makeRelativ(context, href);
        xmlTheme.setHref(xmlHref);

        xmlTheme.setLinktype("zml"); //$NON-NLS-1$

        final List<TypeCurve> xmlCurves = xmlTheme.getCurve();

        final Iterator<ObsViewItem> itCurves = ((List<ObsViewItem>) entry.getValue()).iterator();
        while (itCurves.hasNext()) {
            final DiagViewCurve curve = (DiagViewCurve) itCurves.next();

            final TypeCurve xmlCurve = ODT_OF.createTypeCurve();
            xmlCurve.setId("C" + ixCurve++); //$NON-NLS-1$
            xmlCurve.setName(curve.getName());
            xmlCurve.setColor(StringUtilities.colorToString(curve.getColor()));
            xmlCurve.setShown(curve.isShown());
            final Stroke stroke = curve.getStroke();
            if (stroke instanceof BasicStroke) {
                final BasicStroke bs = (BasicStroke) stroke;
                final TypeCurve.Stroke strokeType = ODT_OF.createTypeCurveStroke();
                xmlCurve.setStroke(strokeType);
                strokeType.setWidth(bs.getLineWidth());
                final float[] dashArray = bs.getDashArray();
                if (dashArray != null) {
                    final List<Float> dashList = strokeType.getDash();
                    for (final float element : dashArray)
                        dashList.add(new Float(element));
                }
            }

            final List<Mapping> xmlMappings = xmlCurve.getMapping();

            final AxisMapping[] mappings = curve.getMappings();
            for (final AxisMapping mapping : mappings) {
                final Mapping xmlMapping = ODT_OF.createTypeCurveMapping();
                xmlMapping.setDiagramAxis(mapping.getDiagramAxis().getIdentifier());
                xmlMapping.setObservationAxis(mapping.getObservationAxis().getName());

                xmlMappings.add(xmlMapping);
            }

            xmlCurves.add(xmlCurve);
        }

        xmlThemes.add(xmlTheme);
    }

    return xmlTemplate;
}

From source file:com.hurence.logisland.utils.DateUtils.java

public static String outputDateInfo(Date d) {
    String output = "";
    Calendar c = GregorianCalendar.getInstance(tz);
    c.setTimeInMillis(d.getTime());/*from w  ww. ja v a  2  s  . com*/
    TimeZone tzCal = c.getTimeZone();

    output += "Date:                         " + d + "\n"; // toString uses current system TimeZone
    output += "Date Millis:                  " + d.getTime() + "\n";
    output += "Cal Millis:                   " + c.getTimeInMillis() + "\n";
    output += "Cal To Date Millis:           " + c.getTime().getTime() + "\n";
    output += "Cal TimeZone Name:            " + tzCal.getDisplayName() + "\n";
    output += "Cal TimeZone ID:              " + tzCal.getID() + "\n";
    output += "Cal TimeZone DST Name:        " + tzCal.getDisplayName(true, TimeZone.SHORT) + "\n";
    output += "Cal TimeZone Standard Name:   " + tzCal.getDisplayName(false, TimeZone.SHORT) + "\n";
    output += "In DayLight:                  " + tzCal.inDaylightTime(d) + "\n";

    output += "" + "\n";
    output += "Day Of Month:                 " + c.get(Calendar.DAY_OF_MONTH) + "\n";
    output += "Month Of Year:                " + c.get(Calendar.MONTH) + "\n";
    output += "Year:                         " + c.get(Calendar.YEAR) + "\n";

    output += "Hour Of Day:                  " + c.get(Calendar.HOUR_OF_DAY) + "\n";
    output += "Minute:                       " + c.get(Calendar.MINUTE) + "\n";
    output += "Second:                       " + c.get(Calendar.SECOND) + "\n";

    return output;
}