Java Parse Date parseDate(Date date, int style, Locale local, boolean withTime)

Here you can find the source of parseDate(Date date, int style, Locale local, boolean withTime)

Description

parse Date

License

Open Source License

Declaration

public static String parseDate(Date date, int style, Locale local, boolean withTime) 

Method Source Code


//package com.java2s;
/*// w ww .j a  v a2  s .  co  m
 *   Copyright (c) 2010 Sonrisa Informatikai Kft. All Rights Reserved.
 * 
 *  This software is the confidential and proprietary information of
 *  Sonrisa Informatikai Kft. ("Confidential Information").
 *  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 Sonrisa.
 * 
 *  SONRISA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
 *  THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
 *  TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
 *  PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SONRISA SHALL NOT BE LIABLE FOR
 *  ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
 *  DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
 */

import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;

public class Main {
    public static String parseDate(Date date, int style, Locale local, boolean withTime) {
        if (date == null) {
            return null;
        } else {
            DateFormat ft = withTime ? DateFormat.getDateTimeInstance(style, style, local)
                    : DateFormat.getDateInstance(style, local);
            return ft.format(date);
        }
    }
}

Related

  1. parseDate(Date date)
  2. parseDate(Date date)
  3. parseDate(Date date)
  4. parseDate(Date date)
  5. parseDate(Date date)
  6. parseDate(Date date, String format)
  7. parseDate(Date date, String pattern)
  8. parseDate(DateFormat df, String dateStr)
  9. parseDate(DateFormat f, String date)