Examples of format()


Examples of java.time.ZonedDateTime.format()

    @Test
    public void unmarshalProducesCorrectLocalDateTimeObject() throws Exception {
        final ZonedDateTime unmarshaled = adapter.unmarshal(DATE_AS_STRING);

        assertEquals(unmarshaled.format(getDateTimeFormatter()), DATE_AS_STRING);
    }

    @Test
    public void marshalProducesCorrectDateTimeString() throws Exception {
        final String marshal = adapter.marshal(ZonedDateTime.parse(DATE_AS_STRING, getDateTimeFormatter()));
View Full Code Here

Examples of java.time.format.DateTimeFormatter.format()

        System.out.println(d5);

        //使用DateTimeFormatter API 解析 和 格式化
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
        LocalDateTime d6 = LocalDateTime.parse("2013/12/31 23:59:59", formatter);
        System.out.println(formatter.format(d6));


        //时间获取
        System.out.println(d6.getYear());
        System.out.println(d6.getMonth());
View Full Code Here

Examples of java.util.Formatter.format()

    } catch (final Exception e) {

      final Formatter out = new Formatter();

      logger.error(out.format("Unable to load factory class [%s]", path)
          .toString());

//      throw new IllegalStateException(e);
    }
  }
View Full Code Here

Examples of java.util.logging.Formatter.format()

            for (int i = 0; i < lineCount; i++) {
                final int ix = (reversed) ?
                    Math.abs((theStart-i)%this.buffer.length) :
                    (theStart+i)%this.buffer.length;
                record = this.buffer[ix];
                logMessages.append(logFormatter.format(record));
            }
            return logMessages.toString();
        } catch (final Exception ex) {
            // We don't want to throw an exception here, but we
            // report the exception to any registered ErrorManager.
View Full Code Here

Examples of java.util.logging.SimpleFormatter.format()

        testing = Errors.getResources(Locale.ENGLISH);
        final LogRecord record = testing.getLogRecord(Level.FINE, Errors.Keys.NullArgument_1, "CRS");
        assertEquals("NullArgument_1", record.getMessage());

        final SimpleFormatter formatter = new SimpleFormatter();
        final String message = formatter.format(record);
        assertTrue(message.contains("Argument ‘CRS’ shall not be null."));
        testing = null;
    }

    /**
 
View Full Code Here

Examples of java.util.logging.XMLFormatter.format()

    //break.
    TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
    rec.setMillis(1234567);
    rec.setSequenceNumber(42);
    rec.setThreadID(21);
    h.check(formatter.format(rec),
            EXPECTED_PREFIX
            + "  <thread>21</thread>\n"
            + "  <message>foobar</message>\n"
            + "</record>\n");
View Full Code Here

Examples of javax.mail.internet.MailDateFormat.format()

    * @param date
    * @return The http://www.faqs.org/rfcs/rfc822.html "date-time" string
    */
   public static String dateTime(Date date) {
      DateFormat df = new MailDateFormat();
      return df.format(date);    
   }
  
   /**
    * @param ts
    * @return The http://www.faqs.org/rfcs/rfc822.html "date-time" string
View Full Code Here

Examples of javax.measure.unit.UnitFormat.format()

                List<String> unitNames = new ArrayList<String>();
                // adding radiance as it's the most common, but it's not part of the standard units
                unitNames.add("W.m-2.Sr-1");
                UnitFormat format = UnitFormat.getInstance(Locale.ENGLISH);
                for (Unit<?> unit : units) {
                    unitNames.add(format.format(unit));
                }

                List<String> choices = new ArrayList<String>();
                for (String name : unitNames) {
                    if (name.toLowerCase().startsWith(input.toLowerCase())) {
View Full Code Here

Examples of javolution.text.TextFormat.format()

                throws XMLStreamException {
            if (value == null)
                return;
            Class type = value.getClass();
            TextFormat format = TextFormat.getInstance(type);
            setAttribute(name, (TextBuilder) format.format(value,
                    _tmpTextBuilder.clear()));
        }

        // Sets XML binding.
        void setBinding(XMLBinding xmlBinding) {
View Full Code Here

Examples of jnode.core.ConcurrentDateFormatAccess.format()

                    return "Bad date(2)";
                }

                Date date = new Date(time);

                return dateFormat.format(date);
            }
        });

    }
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.