Here you can find the source of convertDateTimeToString(Date date)
Parameter | Description |
---|---|
date | to convert |
Parameter | Description |
---|---|
Exception | if error |
public static String convertDateTimeToString(Date date) throws Exception
//package com.java2s; /*//w w w . j a v a 2 s. c o m * Copyright (C) 2010 dungnv. All rights reserved. * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { /** * * @param date to convert * @return String * @throws Exception if error */ public static String convertDateTimeToString(Date date) throws Exception { SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); try { return dateFormat.format(date); } catch (Exception e) { throw e; } } }