Package java.text

Examples of java.text.SimpleDateFormat.applyPattern()


          case 'y': // Year without century (00 - 99).
        fmt.applyPattern("yy");
        fmt.format(date, result, fp);
        break;
          case 'Y': // Year with century (e.g. 1990)
        fmt.applyPattern("yyyy");
        fmt.format(date, result, fp);
        break;
          case 'Z': // Time zone name.
        fmt.applyPattern("zzz");
        fmt.format(date, result, fp);
View Full Code Here


          case 'Y': // Year with century (e.g. 1990)
        fmt.applyPattern("yyyy");
        fmt.format(date, result, fp);
        break;
          case 'Z': // Time zone name.
        fmt.applyPattern("zzz");
        fmt.format(date, result, fp);
        break;
          default:
        result.append(format.charAt(ix));
        break;
View Full Code Here

            if (dateParser == null) {
                dateParser = new SimpleDateFormat(dateFormats[i], Locale.US);
                dateParser.setTimeZone(TimeZone.getTimeZone("GMT"));
                dateParser.set2DigitYearStart(startDate);
            } else {
                dateParser.applyPattern(dateFormats[i]);                   
            }
            try {
                return dateParser.parse(dateValue);
            } catch (ParseException pe) {
                // ignore this exception, we will try the next format
View Full Code Here

            String timeText = completeFile.substring(timePos - 8, timePos + 8);

            // Parse time from response
            ParsePosition position = new ParsePosition(0);
            SimpleDateFormat format = new SimpleDateFormat();
            format.applyPattern("HH:mm:ss'##TIME##'");
            format.parse(timeText, position);

            // Recalculate time for local offset
            Calendar calendar = format.getCalendar();
            Date date = calendar.getTime();
View Full Code Here

            Calendar calendar = format.getCalendar();
            Date date = calendar.getTime();
            date.setTime(date.getTime() - calendar.getTimeZone().getRawOffset());

            // Create new string to be placed in response
            format.applyPattern("HH:mm:ss'.000Z'");
            String gmText = format.format(date);
           
            // Replace in response
            completeFile = completeFile.replaceFirst(timeText, gmText);
           
View Full Code Here

        try
        {
          SimpleDateFormat dateFormat = new SimpleDateFormat(formatsIn[i], Locale.ENGLISH);
          dateFormat.setLenient(false);
          Date dt = dateFormat.parse(in);         
          dateFormat.applyPattern(formatOut);
          return dateFormat.format(dt);
        }
        catch (ParseException pe)
        {
        }
View Full Code Here

  {
    try
    {
      SimpleDateFormat sdf = new SimpleDateFormat();

      sdf.applyPattern("dd/MM/yyyy");

      return sdf.parse(str);
    }
    catch (ParseException e)
    {
View Full Code Here

  {
    try
    {
      SimpleDateFormat sdf = new SimpleDateFormat();

      sdf.applyPattern(format);

      return sdf.parse(str);
    }
    catch (ParseException e)
    {
View Full Code Here

  public static String format(Date dat, String format)
  {
    SimpleDateFormat sdf = new SimpleDateFormat();

    sdf.applyPattern(format);

    return sdf.format(dat);
  }

  public static String en2pt(String str)
View Full Code Here

            String format = (String) formatIter.next();           
            if (dateParser == null) {
                dateParser = new SimpleDateFormat(format, Locale.US);
                dateParser.setTimeZone(TimeZone.getTimeZone("GMT"));
            } else {
                dateParser.applyPattern(format);                   
            }
            try {
                return dateParser.parse(dateValue);
            } catch (ParseException pe) {
                // ignore this exception, we will try the next format
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.