/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: DateUtils.java,v 1.2 2008/06/25 05:53:00 qcheng Exp $
*
* Portions Copyrighted 2014-2015 ForgeRock AS.
* Portions Copyrighted 2013 Cybernetica AS
*/
/**
* This class provides utility to perform date conversion.
*/
public class DateUtils {
/**
* Returns <code>yyyy-MM-dd HH:mm:ss</code> String representation of a
* date.
*
* @param date Date object.
* @return The formatted date.
*/
}
/**
* Returns UTC String representation of a date. For instance,
* 2004-03-20T05:53:32Z.
*
* @param date Date object.
* @return The formatted date.
*/
}
/**
* Returns UTC String representation of a date with milliseconds. For instance,
* 2004-03-20T05:53:32.321Z.
*
* @param date Date object.
* @return The formatted date.
*/
}
/**
* Returns ISO-8601 (RFC3339) compatible representation of local date and time and time offset.
* For instance, 2004-03-20T07:53:32+02:00.
*
* @param date Date object.
* @return The formatted date.
*/
}
}
if (offset == 0) {
} else {
}
}
for (int i = 0; i < diff; i++) {
}
return val;
}
/**
* Returns date that is represented by a string. It uses the following
* representation of date. yyyy-MM-DD'T'hh:mm:ss based on the following
* definition of "dateTime" attribute in XML schema which can be found at
* http://www.w3.org/TR/xmlschema-2/#dateTime. A single lexical
* representation, which is a subset of the lexical representations allowed
* by [ISO 8601], is allowed for dateTime. This lexical representation is
* the [ISO 8601] extended format CCYY-MM-DDThh:mm:ss where "CC" represents
* the century, "YY" the year, "MM" the month and "DD" the day, preceded by
* an optional leading "-" sign to indicate a negative number. If the sign
* "hh", "mm", "ss" represent hour, minute and second respectively.
* Additional digits can be used to increase the precision of fractional
* seconds if desired i.e the format ss.ss... with any number of digits
* after the decimal point is supported. The fractional seconds part is
* optional; other parts of the lexical form are not optional. To
* accommodate year values greater than 9999 additional digits can be added
* to the left of this representation. Leading zeros are required if the
* year value would otherwise have fewer than four digits; otherwise they
* are forbidden. The year 0000 is prohibited. The CCYY field must have at
* least four digits, the MM, DD, SS, hh, mm and ss fields exactly two
* digits each (not counting fractional seconds); leading zeroes must be
* used if the field would otherwise have too few digits.
*
* This representation may be immediately followed by a "Z" to indicate
* Coordinated Universal Time (UTC) or, to indicate the time zone, i.e. the
* difference between the local time and Coordinated Universal Time,
* immediately followed by a sign, + or -, followed by the difference from
* UTC represented as hh:mm (note: the minutes part is required). See ISO
* 8601 Date and Time Formats ('D) for details about legal values in the
* various fields. If the time zone is included, both hours and minutes must
* be present.
*
* For example, to indicate 1:20 pm on May the 31st, 1999 for Eastern
* Standard Time which is 5 hours behind Coordinated Universal Time (UTC),
* one would write: 1999-05-31T13:20:00-05:00.
*
* @param strDate String representation of date.
* @throws ParseException if <code>strDate</code> is in an invalid format.
*/
boolean plusTime = true;
// get time differences (if any)
if (idxT == -1) {
}
if (idxDiffUTC == -1) {
plusTime = false;
}
if (idxDiffUTC != -1) {
}
// remove the trailing z/Z character
}
}
/**
* Returns the difference portion of a date string. Array of integer with
* the first element defining the hour difference; and second element
* defining the minute difference
*
* @param strDate Date String.
* @param idx Index of the +/- character.
* @returns the difference portion of a date string.
* @throws ParseException if <code>strDate</code> is in an invalid format.
*/
throws ParseException {
int[] diffArray = new int[2];
if (colonIdx == -1) {
}
try {
} catch (NumberFormatException nfe) {
}
return diffArray;
}
/**
* Returns a date with a string of yyyy-MM-ssThh:mm:ss or yyyy-MM-ssThh:mm.
*
* @param strDate String representation of a date.
* @param timeDiff Time differences
* to the computed date. Ignore this value if <code>timeDiff</code>
* is null.
*/
int[] timeDiff,
boolean plusDiff
) throws ParseException {
try {
}
}
}
}
int second = 0;
}
}
int milliSeconds = 0;
// Take up to 3 digits of the remainder (including .) of the string as the fraction of a second
}
}
}
} catch (NumberFormatException nfe) {
}
}
}