Java Parse Date Pattern YYYY parseLastModifDate(final File file)

Here you can find the source of parseLastModifDate(final File file)

Description

Parse date with pattern yyyyMMddHHmm.

License

Open Source License

Parameter

Parameter Description
file input file.

Return

parsed file modification date.

Declaration

public static String parseLastModifDate(final File file) 

Method Source Code


//package com.java2s;
/*//w w w .  ja  va2s.c  o m
 * CKFinder
 * ========
 * http://ckfinder.com
 * Copyright (C) 2007-2013, CKSource - Frederico Knabben. All rights reserved.
 *
 * The software, this file and its contents are subject to the CKFinder
 * License. Please read the license.txt file before using, installing, copying,
 * modifying or distribute this file or part of its contents. The contents of
 * this file is part of the Source Code of CKFinder.
 */

import java.io.File;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**
     * Parse date with pattern yyyyMMddHHmm. Pattern is used in get file command
     * response XML.
     * @param file input file.
     * @return parsed file modification date.
     */
    public static String parseLastModifDate(final File file) {
        Date date = new Date(file.lastModified());
        DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmm");
        return dateFormat.format(date);
    }
}

Related

  1. parseFullTime(String str)
  2. parseGeneralizedTimeAsDate(String generalizedTime)
  3. parseHeaderDate(String headerValue)
  4. parseHHMMSS(long time)
  5. parseInsituFileNameDateFormat(String timeString)
  6. parseLogstashDate(final String date_string)
  7. parsemm(String dateStr)
  8. parseMysql(String s)
  9. parseMysqlDate(String dateStr)