Package java.text

Examples of java.text.DateFormat$DateFormatGetter


    assertEquals(59,c.get(Calendar.MINUTE));
    assertEquals(59,c.get(Calendar.SECOND));
  }
 
  public void testAddNHours() throws Exception{
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
    Date date = df.parse("2007-01-11T00:00:00");
    date = GnizrDaoUtil.addNHours(date,24);
    Calendar c = Calendar.getInstance();
    c.setTime(date);
    assertEquals(2007,c.get(Calendar.YEAR));
    assertEquals(0,c.get(Calendar.MONTH));
View Full Code Here


    assertEquals(0,c.get(Calendar.MINUTE));
    assertEquals(0,c.get(Calendar.SECOND));
  }
 
  public void testSubNHours() throws Exception{
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
    Date date = df.parse("2007-01-11T00:00:00");
    date = GnizrDaoUtil.subNHours(date,24);
    Calendar c = Calendar.getInstance();
    c.setTime(date);
    assertEquals(2007,c.get(Calendar.YEAR));
    assertEquals(0,c.get(Calendar.MONTH));
View Full Code Here

  public TestMiscPointFeature(String name) {
    super(name);
  }

  public void testIterator() {
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    FeatureDataset fd = null;
    try {
      Formatter formatter = new Formatter(System.err);
      fd = FeatureDatasetFactoryManager.open(FeatureType.STATION, "src/test/data/point/StandardPointFeatureIteratorIssue.ncml", null, formatter);
      if (fd != null && fd instanceof FeatureDatasetPoint) {
        FeatureDatasetPoint fdp = (FeatureDatasetPoint) fd;
        FeatureCollection fc = fdp.getPointFeatureCollectionList().get(0);
        if (fc != null && fc instanceof StationTimeSeriesFeatureCollection) {
          StationTimeSeriesFeatureCollection stsfc =
                  (StationTimeSeriesFeatureCollection) fc;
          // subset criteria not important, just want to get data
          // into flattened representation
          PointFeatureCollection pfc = stsfc.flatten(
                  new LatLonRect(
                          new LatLonPointImpl(-90, -180),
                          new LatLonPointImpl(90, 180)),
                  new DateRange(
                          df.parse("1900-01-01"),
                          df.parse("2100-01-01")));
          PointFeatureIterator pfi = pfc.getPointFeatureIterator(-1);
          try {
            while (pfi.hasNext()) {
              PointFeature pf = pfi.next();
              // the call to cursor.getParentStructure() in
View Full Code Here

        }
        final String pattern = this.getPattern();
        String result = null;
        if (value != null && pattern != null && pattern.trim().length() > 0)
        {
            DateFormat format = new SimpleDateFormat(pattern);
            format.setTimeZone(this.getTimeZone());
            result = format.format((Date)value);
        }
        return result;
    }
View Full Code Here

    /* Check if Cached already */
    if (DATE_COL_WIDTH > 0)
      return DATE_COL_WIDTH;

    /* Calculate and Cache */
    DateFormat dF = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
    Calendar cal = Calendar.getInstance();
    cal.set(2006, Calendar.DECEMBER, 12, 12, 12, 12);
    String sampleDate = dF.format(cal.getTime());

    DATE_COL_WIDTH = OwlUI.getTextSize(fCustomTree.getControl(), OwlUI.getBold(JFaceResources.DEFAULT_FONT), sampleDate).x;
    DATE_COL_WIDTH += 30; // Bounds of TableColumn requires more space

    return DATE_COL_WIDTH;
View Full Code Here

    /* Check if Cached already */
    if (DATE_COL_WIDTH > 0)
      return DATE_COL_WIDTH;

    /* Calculate and Cache */
    DateFormat dF = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
    Calendar cal = Calendar.getInstance();
    cal.set(2006, Calendar.DECEMBER, 12, 12, 12, 12);
    String sampleDate = dF.format(cal.getTime());

    DATE_COL_WIDTH = OwlUI.getTextSize(fResultViewer.getTable(), OwlUI.getBold(JFaceResources.DEFAULT_FONT), sampleDate).x;
    DATE_COL_WIDTH += 30; // Bounds of TableColumn requires more space

    return DATE_COL_WIDTH;
View Full Code Here

     * @deprecated As of JDK version 1.1,
     * replaced by <code>DateFormat.format(Date date)</code>.
     */
    @Deprecated
    public String toLocaleString() {
  DateFormat formatter = DateFormat.getDateTimeInstance();
  return formatter.format(this);
    }
View Full Code Here

    /* Check if Cached already */
    if (DATE_WIDTH > 0)
      return DATE_WIDTH;

    /* Calculate and Cache */
    DateFormat dF = getShortDateFormat();
    Calendar cal = Calendar.getInstance();
    cal.set(2006, Calendar.DECEMBER, 12, 12, 12, 12);
    String sampleDate = dF.format(cal.getTime());

    DATE_WIDTH = OwlUI.getTextSize(Display.getDefault(), OwlUI.getBold(HEADLINES_FONT_ID), sampleDate).x;
    DATE_WIDTH += Application.IS_WINDOWS ? 15 : 30; // Bounds of Column requires more space

    return DATE_WIDTH;
View Full Code Here

    public static DateFormat getTimeFormat(int pattern) {
        return DateFormat.getTimeInstance(pattern);
    }       
   
    public static DateFormat getShortDateFormat() {
        DateFormat df = getDateFormat(DateFormat.SHORT);
        df.setLenient(false);
        return df;
    }
View Full Code Here

        df.setLenient(false);
        return df;
    }
   
    public static DateFormat getShortDateTimeFormat() {
        DateFormat df = getDateTimeFormat(DateFormat.SHORT, DateFormat.SHORT);
        df.setLenient(false);
        return df;
    }   
View Full Code Here

TOP

Related Classes of java.text.DateFormat$DateFormatGetter

Copyright © 2018 www.massapicom. 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.