Package java.text

Examples of java.text.Format.format()


            subMap.put("snapshot_time", ((Long) mapTimeFix.get("times").get(
                    "snapshot_time") - (getSnapshotDuration() * skipCount)));
            Format formatter = null;
            formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = new Date((Long) subMap.get("snapshot_time"));
            subMap.put("snapshot_date", formatter.format(date));

            // Add the submap back to the tempmap
            tempMap.put("times", new HashMap<String, Object>(subMap));

            // Clear out the subMap for use again
View Full Code Here


                            "times").get("snapshot_time")
                            - (getSnapshotDuration() * skipCount)));
                    Format formatter = null;
                    formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    Date date = new Date((Long) subMap.get("snapshot_time"));
                    subMap.put("snapshot_date", formatter.format(date));
                    tempMap.put("times", new HashMap<String, Object>(subMap));
                    subMap.clear();
                    snapshotList.add(i,
                            new HashMap<String, HashMap<String, Object>>(
                                    tempMap));
View Full Code Here

        if (graph != null) {
            // get the current date
            Format formatter = null;
            formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = new Date(System.currentTimeMillis());
            String currentTime = formatter.format(date);
            // the graph was successfully operated on,
            // so update the last_seen attribute
            DBManager dbManager = new DBManager();
            Connection conn = dbManager.getConnection();
            Statement stmt = conn.createStatement();
View Full Code Here

  }

  //Formats a Unix timestamp according to RFC 3339
  private String formatTime(long time) {
    final Format format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
    String date = format.format(new Date(time));
    //Z doesn't include a colon between the hour and the minutes
    return date.substring(0, 22) + ":" + date.substring(22);
  }

  public String getAtom(String startURI) {
View Full Code Here

    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);
    }

    public static Object formatDate(Date date) {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        AbstractCalendar calendarInstance = (AbstractCalendar) AbstractCalendar.getCurrentComponent(facesContext);
View Full Code Here

    }
   
    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

        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

        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

        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

        }
        else
        {
            try
            {
                insert = format.format(value);
            }
            catch (Exception ex)
            {
                throw new ApplicationRuntimeException(
                    Tapestry.format("Insert.unable-to-format", value),
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.