Package java.text

Examples of java.text.SimpleDateFormat.format()


            case DATE:

                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

                return format.format((Date) value);

            case NODE:
                return ((NodeHandle) value).getID();
        }
View Full Code Here


  }
 
  private static String formatDate(long date, String format) {
    if (date == 0) {return "";}
    SimpleDateFormat temp = new SimpleDateFormat(format);
    return temp.format(new Date(date));
  }

  public static String formatDate(long date) {
    return formatDate(date, "dd-MMM-yyyy HH:mm:ss");
  }
View Full Code Here

     * @param seconds The current timestamp in seconds.
     * @return a formatted date/time String in the format "yyyy-MM-dd HH:mm:ss".
     */
    public static String fromUnixTime(int seconds) {
        SimpleDateFormat formatter = new SimpleDateFormat(DATE_TIME_FORMAT, Locale.ENGLISH);
        return formatter.format(new Date(seconds * 1000L));
    }

    /**
     * See
     * http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime
 
View Full Code Here

     * @return a formatted date/time String in the given format.
     */
    public static String fromUnixTime(int seconds, String format) {
        format = convertToSimpleDateFormat(format);
        SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ENGLISH);
        return formatter.format(new Date(seconds * 1000L));
    }

    private static String convertToSimpleDateFormat(String format) {
        String[] replace = FORMAT_REPLACE;
        for (int i = 0; i < replace.length; i += 2) {
View Full Code Here

        for (Program program : programs) {
            final Calendar start = CalendarToolbox.getStartAsCalendar(program);
            final Calendar end   = CalendarToolbox.getEndAsCalendar(program);

            script.append("  set startDate to my getDateForISOdate(\"").append(formatDay.format(start.getTime())).append("\", \"").append(formatHour.format(start.getTime())).append("\")\n");
            script.append("  set endDate to my getDateForISOdate(\"").append(formatDay.format(end.getTime())).append("\", \"").append(formatHour.format(end.getTime())).append("\")\n");
            script.append("\n");
            script.append("  set props to {start date:startDate, end date:endDate, summary:\"");

            ParamParser parser = new ParamParser();
View Full Code Here

        for (Program program : programs) {
            final Calendar start = CalendarToolbox.getStartAsCalendar(program);
            final Calendar end   = CalendarToolbox.getEndAsCalendar(program);

            script.append("  set startDate to my getDateForISOdate(\"").append(formatDay.format(start.getTime())).append("\", \"").append(formatHour.format(start.getTime())).append("\")\n");
            script.append("  set endDate to my getDateForISOdate(\"").append(formatDay.format(end.getTime())).append("\", \"").append(formatHour.format(end.getTime())).append("\")\n");
            script.append("\n");
            script.append("  set props to {start date:startDate, end date:endDate, summary:\"");

            ParamParser parser = new ParamParser();
View Full Code Here

    if(locale == null)
      locale = Locale.SIMPLIFIED_CHINESE;
    Calendar today = Calendar.getInstance(locale);
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy��MM��dd�� EEE", locale);
    try{
      return sdf.format(today.getTime());
    }finally{
      today = null;
      sdf = null;
    }
  }
View Full Code Here

  public void testZoneDate() throws ParseException {
    Date date = new Date();
    SimpleDateFormat dateFormat = new SimpleDateFormat(
    "yyyy-MM-dd'T'HH:mm:ss.SSSZ");
   
    String noColumnYet = dateFormat.format(date);
    StringBuffer result = new StringBuffer(noColumnYet);
    result.insert(noColumnYet.length() - 2, ':');
    Date parsed = MillisDateFormat.instance.parse(result.toString());
    assertEquals(date, parsed);
  }
View Full Code Here

        Mapping.rollback();

        request.setAttribute("publication", publication);
        request.setAttribute("editForm", editForm);
        SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
        sform.setDate(formatter.format(publication.getDate()));

      } catch (Exception e) {
        Mapping.rollback();
        throw new ServletException(e);
      }
View Full Code Here

    return (buf.toString());
  }

  public String  getAtimeString(){
    SimpleDateFormat locale=new SimpleDateFormat();
    return (locale.format(new Date(atime)));
  }

  public String  getMtimeString(){
    Date date= new Date(((long)mtime)*1000);
    return (date.toString());
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.