Java String to Date toDateString(String fmt, Date date)

Here you can find the source of toDateString(String fmt, Date date)

Description

to Date String

License

Open Source License

Declaration

public static String toDateString(String fmt, Date date) 

Method Source Code

//package com.java2s;
/**//from  www .j  a v a  2  s  .  com
 * KTH Developed by Java
 *
 * @Copyright 2011 by Service Platform Development Team, KTH, Inc. All rights reserved.
 *
 * This software is the confidential and proprietary information of KTH, Inc.
 * You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the license agreement you entered into with KTH.
 */

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static String toDateString() {
        return toDateString("yyyy-MM-dd HH:mm:ss", new Date());
    }

    public static String toDateString(String fmt, Date date) {
        return new SimpleDateFormat(fmt).format(date);
    }
}

Related

  1. toDateString(java.util.Date date)
  2. toDateString(java.util.Date date, String format)
  3. toDateString(java.util.Date date, String spe)
  4. toDateString(long lval)
  5. toDateString(long ms)
  6. toDateStyleBoth(String dateStr)
  7. toDatetime(String sDate)
  8. toDateTimeFormat(String input, String inputfmt, String outputfmt)
  9. toDateTimeSSSString(long datetime)