Package org.apache.commons.lang.time

Examples of org.apache.commons.lang.time.FastDateFormat.format()


        if (this.timeZone == null) {
          dateformat = FastDateFormat.getInstance(this.logDateFormat);
        } else {
          dateformat = FastDateFormat.getInstance(this.logDateFormat, TimeZone.getTimeZone(this.timeZone));
        }
        paramPut(LOG_TIME, dateformat.format(new Date()));
        this.paramPut(REPLY_TIME,REPLY_TIME);
        this.paramPut(LOG_ID, "0");
  }
 
  /**
 
View Full Code Here


            if (attr.getAttrType().getId().equals(id_pda_dateOfBirth)) {
              ASN1Set set = attr.getAttrValues();
              // Come on, we'll only allow one dateOfBirth, we're not allowing such frauds with multiple birth dates
              DERGeneralizedTime time = DERGeneralizedTime.getInstance(set.getObjectAt(0));
              Date date = time.getDate();
              String dateStr = dateF.format(date);
              result += prefix + "dateOfBirth="+dateStr;
            }
            if (attr.getAttrType().getId().equals(id_pda_placeOfBirth)) {
              ASN1Set set = attr.getAttrValues();
              // same here only one placeOfBirth
View Full Code Here

        // Test time constraints
        final EndEntityProfile profile = new EndEntityProfile();
        Date now = new Date();
        Date endOfTime = new Date(Long.MAX_VALUE);
        FastDateFormat sm = FastDateFormat.getInstance("yyyy-MM-dd HH:mm");
        String staticNow = sm.format(now);
        String relativeNow = "0:00:00";
        String staticEndOfTime = sm.format(endOfTime);
        String relativeEndOfTime = "33000:00:00"; // ~100 years
        String staticInvalid = "XXXX-XX-XX XX:XX PM";
        String relativeInvalid = "XXXXX:XXX:XXX";
View Full Code Here

        Date now = new Date();
        Date endOfTime = new Date(Long.MAX_VALUE);
        FastDateFormat sm = FastDateFormat.getInstance("yyyy-MM-dd HH:mm");
        String staticNow = sm.format(now);
        String relativeNow = "0:00:00";
        String staticEndOfTime = sm.format(endOfTime);
        String relativeEndOfTime = "33000:00:00"; // ~100 years
        String staticInvalid = "XXXX-XX-XX XX:XX PM";
        String relativeInvalid = "XXXXX:XXX:XXX";
        String relativeNegative = "-10:00:00";
        ExtendedInformation ei = new ExtendedInformation();
View Full Code Here

            final FastDateFormat newDateFormat = FastDateFormat.getInstance("yyyy-MM-dd HH:mm");
            try {
              final String oldCustomStartTime = getCustomData(ExtendedInformation.CUSTOM_STARTTIME);
              if ( !isEmptyOrRelative(oldCustomStartTime) ) {
                // We use an absolute time format, so we need to upgrade
                  final String newCustomStartTime = newDateFormat.format(oldDateFormat.parse(oldCustomStartTime));
              setCustomData(ExtendedInformation.CUSTOM_STARTTIME, newCustomStartTime);
              if (log.isDebugEnabled()) {
                log.debug("Upgraded " + ExtendedInformation.CUSTOM_STARTTIME + " from \"" + oldCustomStartTime + "\" to \"" + newCustomStartTime + "\" in ExtendedInformation.");
              }
              }
View Full Code Here

        }
            try {
              final String oldCustomEndTime = getCustomData(ExtendedInformation.CUSTOM_ENDTIME);
              if ( !isEmptyOrRelative(oldCustomEndTime) ) {
                // We use an absolute time format, so we need to upgrade
                  final String newCustomEndTime = newDateFormat.format(oldDateFormat.parse(oldCustomEndTime));
              setCustomData(ExtendedInformation.CUSTOM_ENDTIME, newCustomEndTime);
              if (log.isDebugEnabled()) {
                log.debug("Upgraded " + ExtendedInformation.CUSTOM_ENDTIME + " from \"" + oldCustomEndTime + "\" to \"" + newCustomEndTime + "\" in ExtendedInformation.");
              }
              }
View Full Code Here

            final FastDateFormat newDateFormat = FastDateFormat.getInstance("yyyy-MM-dd HH:mm");
            try {
              final String oldStartTime = getValue(STARTTIME, 0);
              if (!isEmptyOrRelative(oldStartTime)) {
                // We use an absolute time format, so we need to upgrade
                  final String newStartTime = newDateFormat.format(oldDateFormat.parse(oldStartTime));
              setValue(STARTTIME, 0, newStartTime);
              if (log.isDebugEnabled()) {
                log.debug("Upgraded " + STARTTIME + " from \"" + oldStartTime + "\" to \"" + newStartTime + "\" in EndEntityProfile.");
              }
              }
View Full Code Here

        }
            try {
              final String oldEndTime = getValue(ENDTIME, 0);
              if (!isEmptyOrRelative(oldEndTime)) {
                // We use an absolute time format, so we need to upgrade
                  final String newEndTime = newDateFormat.format(oldDateFormat.parse(oldEndTime));
              setValue(ENDTIME, 0, newEndTime);
              if (log.isDebugEnabled()) {
                log.debug("Upgraded " + ENDTIME + " from \"" + oldEndTime + "\" to \"" + newEndTime + "\" in EndEntityProfile.");
              }
              }
View Full Code Here

   * if no pattern has been set
   */
  public static String convertToString(Calendar c, String pattern, Locale locale) {
    FastDateFormat formatter = getFormatter(pattern, locale);

    return formatter.format(c);
  }

  public static String convertToString(Date date, String pattern, Locale locale) {
    FastDateFormat formatter = getFormatter(pattern, locale);

View Full Code Here

  }

  public static String convertToString(Date date, String pattern, Locale locale) {
    FastDateFormat formatter = getFormatter(pattern, locale);

    return formatter.format(date);
  }

  public static FastDateFormat getFormatter(String pattern, Locale locale){
    FastDateFormat formatter = null;
   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.