Package java.text

Examples of java.text.Format


        return formatDate(date);
    }

    public String getCurrentDateAsString(FacesContext facesContext, UIComponent component) throws IOException {
        AbstractCalendar calendar = (AbstractCalendar) component;
        Format formatter = new SimpleDateFormat("MM/yyyy");

        Date currentDate = CalendarHelper.getCurrentDateOrDefault(facesContext, calendar);
        return formatter.format(currentDate);
    }
View Full Code Here


      return;
    }
   
    ResultSet rset = null;
    Statement stmt = null;
    Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String date = formatter.format(new Date());
    String sql;
    sql = "update Client";
    sql += " set DateUpdated='" + date + "'";
    sql += " where (ClientID=1);";
   
View Full Code Here

      } catch (InterruptedException ie) {
        System.out.println("Sleep interrupted");
      }
     
      System.out.println("Continued after sleep");
      Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      String date = formatter.format(new Date());
      sql = "update Client";
      sql += " set DateUpdated='" + date + "'";
      sql += " where (ClientID=1);";
      stmtUpdate = connUpdate.createStatement();
      stmtUpdate.execute(sql);
View Full Code Here

      } catch (InterruptedException ie) {
        System.out.println("Sleep interrupted");
      }
     
      System.out.println("Continued after sleep");
      Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      String date = formatter.format(new Date());
      sql = "update Client";
      sql += " set DateUpdated='" + date + "'";
      sql += " where (ClientID=1);";
      stmt.execute(sql);
      conn.commit();
View Full Code Here

     * @throws JobExecutionException
     */
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        Date date = new Date();
        Format yearFormat = new SimpleDateFormat("yyyy");
        Format monthFormat = new SimpleDateFormat("MM");
        Format dayFormat = new SimpleDateFormat("dd");
        String pathToDayDir = Vars.Lector_Repository + "/" + yearFormat.format(date)
                + "/" + monthFormat.format(date) + "/" + dayFormat.format(date);
        File pathToDayDirFile = new File(pathToDayDir);
        if (!pathToDayDirFile.exists()) {
            pathToDayDirFile.mkdirs();
        }
        Vars.pathToDayDir = pathToDayDir;
View Full Code Here

    if (locale != null)
    {
      error.setVariable("locale", locale);
    }
    error.setVariable("exception", e);
    Format format = e.getFormat();
    if (format instanceof SimpleDateFormat)
    {
      error.setVariable("format", ((SimpleDateFormat)format).toLocalizedPattern());
    }
View Full Code Here

        if (value == null)
            return;

        String insert = null;

        Format format = getFormat();

        if (format == null)
        {
            insert = value.toString();
        }
        else
        {
            try
            {
                insert = format.format(value);
            }
            catch (Exception ex)
            {
                throw new ApplicationRuntimeException(
                    Tapestry.format("Insert.unable-to-format", value),
View Full Code Here

    });
  }

  @Test
  public void testDateTimeWidget() {
    Format format = new SimpleDateFormat(CalendarAction.DATE_FORMAT);
    Calendar date = new GregorianCalendar(2100, Calendar.JANUARY, 1);
    CalendarAction action = CalendarAction.create(manager, shell, date, null,
        null);

    SWTBotDateTime bot = new SWTBotDateTime(action.getDateTime());
    assertEquals(format.format(date.getTime()), format.format(bot.getDate()));

    date = new GregorianCalendar(2012, Calendar.DECEMBER, 21);
    bot.setDate(date.getTime());
    assertEquals(format.format(date.getTime()), action.getText());

    Calendar cal = action.getCalendar();
    assertEquals(format.format(date.getTime()), format.format(cal.getTime()));
  }
View Full Code Here

  }

  @Test
  public void testFormat() {
    Calendar date = Calendar.getInstance();
    Format format = new SimpleDateFormat(CalendarAction.DATE_FORMAT);
    String text = format.format(date.getTime());
    IAction action = CalendarAction.create(manager, shell, date, null, null);
    assertEquals(text, action.getText());
  }
View Full Code Here

    });

    SWTBotShell bot = new SWTBotShell(action.getShell());
    bot.bot().link().click();

    Format format = new SimpleDateFormat(CalendarAction.DATE_FORMAT);
    assertEquals(format.format(today.getTime()), action.getText());

    Calendar cal = action.getCalendar();
    assertEquals(format.format(today.getTime()), format.format(cal.getTime()));
  }
View Full Code Here

TOP

Related Classes of java.text.Format

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.