Example usage for org.apache.commons.lang3.time DateFormatUtils format

List of usage examples for org.apache.commons.lang3.time DateFormatUtils format

Introduction

In this page you can find the example usage for org.apache.commons.lang3.time DateFormatUtils format.

Prototype

public static String format(final Calendar calendar, final String pattern) 

Source Link

Document

Formats a calendar into a specific pattern.

Usage

From source file:com.assignmentone.snippet.ComplicatedSnippet.java

public Renderer inner(String name, int age, Date currenttime, List<String> list) {
    // receive the parameters by method declaration and then make use of them
    Renderer render = new GoThroughRenderer();
    render.add("p#name span", name);
    render.add("p#age span", age);
    render.add("p#currenttime span", DateFormatUtils.format(currenttime, "yyyy/MM/dd HH:mm:ss"));
    render.add("ul#list li", list);
    return render;
}

From source file:com.mmone.gpdati.allotment.record.AllotmentRecord.java

public String getDateTo(String dtFormat) throws ParseException {
    return DateFormatUtils.format(getJDateTo(), dtFormat);
}

From source file:com.omertron.slackbot.model.sheets.GameLogRow.java

public String getFormattedDate(String format) {
    return DateFormatUtils.format(date, format);
}

From source file:eionet.webq.dto.FileInfo.java

/**
 * Get user-friendly formatted file last modified date.
 *
 * @return updated date in String format
 *//*from w w w.  j  a v  a 2  s  .c  om*/
@XmlElement(name = "updated")
public String getUpdated() {
    return (updatedDate != null) ? DateFormatUtils.format(updatedDate, USERFRIENDLY_DATE_FORMAT) : null;
}

From source file:com.mmone.gpdati.allotment.record.AllotmentRecord.java

public String getDateToY_M_D() throws ParseException {
    String dtFormat = "yyyy-MM-dd";
    return DateFormatUtils.format(getJDateTo(), dtFormat);
}

From source file:com.mmone.gpdati.allotment.record.AllotmentRecord.java

public String getDateToD_M_Y() throws ParseException {
    String dtFormat = "dd-MM-yyyy";
    return DateFormatUtils.format(getJDateTo(), dtFormat);
}

From source file:eionet.webq.dto.FileInfo.java

/**
 * Get user-friendly formatted file last downloaded date.
 *
 * @return downloaded date in String format
 *///  w w  w  .  j a  va 2  s.c  o m
@XmlElement(name = "downloaded")
public String getDownloaded() {
    return (downloadedDate != null) ? DateFormatUtils.format(downloadedDate, USERFRIENDLY_DATE_FORMAT) : null;
}

From source file:cn.mypandora.util.MyDateUtils.java

/**
 * ?//from www . j  a  v a  2  s  .  c o m
 *
 * @return
 */
public static String getPreviousMonthEnd() {
    Calendar cal = Calendar.getInstance();
    Calendar f = (Calendar) cal.clone();
    f.clear();
    // 
    // f.set(Calendar.YEAR, cal.get(Calendar.YEAR));
    // f.set(Calendar.MONTH, cal.get(Calendar.MONTH));
    // f.set(Calendar.MILLISECOND, -1);
    // return DateFormatUtils.format(f, DATE_FORMAT);

    // 
    // f.set(Calendar.YEAR, cal.get(Calendar.YEAR));
    // f.set(Calendar.MONTH, cal.get(Calendar.MONTH) - 1);
    // f.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DATE));
    // return DateFormatUtils.format(f, DATE_FORMAT);

    // (?)
    cal.set(Calendar.DATE, 1);// ?1?
    cal.add(Calendar.MONTH, 0);//
    cal.add(Calendar.DATE, -1);// ???
    return DateFormatUtils.format(cal, DATE_FORMAT);
}

From source file:javafxapplication2.FXMLDocumentController.java

private void display(String path) {
    File home = new File(path);
    File[] subFiles = home.listFiles();

    for (File subFile : subFiles) {
        TableRowDataBean rowData = new TableRowDataBean(subFile.getName(), subFile.length(), subFile.getPath(),
                DateFormatUtils.format(new Date(subFile.lastModified()), DATE_PATTERN));
        rowDataList.add(rowData);/*w w  w  . j av a  2s.c  o  m*/
    }
    table1.getItems().clear();
    table1.setItems(rowDataList);
    table1.layout();
}

From source file:com.eryansky.modules.disk.utils.DiskUtils.java

/**
 *  ???//from w w w  . ja va  2s. c o  m
 *
 * @param folder
 *            
 * @return
 */
public static String getRelativePath(Folder folder, String userId) {
    Date now = Calendar.getInstance().getTime();
    StringBuffer path = new StringBuffer();
    path.append(DateFormatUtils.format(now, "yyyy")).append(java.io.File.separator);
    String folderAuthorize = FolderAuthorize.getFolderAuthorize(folder.getFolderAuthorize()).toString()
            .toLowerCase();
    path.append(userId).append(java.io.File.separator).append(folderAuthorize).append(java.io.File.separator);
    if (FolderAuthorize.User.getValue().equals(folder.getFolderAuthorize())) {
        path.append(folder.getId());
    } else if (FolderAuthorize.Organ.getValue().equals(folder.getFolderAuthorize())) {
        path.append(folder.getOrganId()).append(java.io.File.separator).append(folder.getId());
    } else if (FolderAuthorize.Role.getValue().equals(folder.getFolderAuthorize())) {
        path.append(folder.getRoleId()).append(java.io.File.separator).append(folder.getId());
    } else if (FolderAuthorize.Public.getValue().equals(folder.getFolderAuthorize())) {
        path.append(folder.getId());
    } else if (FolderAuthorize.SysTem.getValue().equals(folder.getFolderAuthorize())) {
        path.append(folder.getCode());
    }
    return path.toString();
}