001 /*
002 Copyright (c) 2009 Olivier Chafik, All Rights Reserved
003
004 This file is part of JNAerator (http://jnaerator.googlecode.com/).
005
006 JNAerator is free software: you can redistribute it and/or modify
007 it under the terms of the GNU General Public License as published by
008 the Free Software Foundation, either version 3 of the License, or
009 (at your option) any later version.
010
011 JNAerator is distributed in the hope that it will be useful,
012 but WITHOUT ANY WARRANTY; without even the implied warranty of
013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014 GNU General Public License for more details.
015
016 You should have received a copy of the GNU General Public License
017 along with JNAerator. If not, see <http://www.gnu.org/licenses/>.
018 */
019 package com.ochafik.util;
020 /*
021 Calendar cal = Calendar.getInstance();
022 ou si l'on veut preciser une zone horaire (ici Europe Central Time)
023 Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("ECT"));
024
025 Ensuite sur cet objet on peut récupérer l'heure, les minutes ...
026
027 cal.get(Calendar.HOUR);
028 cal.get(Calendar.MINUTES);
029 cal.get(Calendar.DAY_OF_YEAR); //... voir java.util.Calendar
030
031 Ou afficher un résultat formaté :
032
033 System.out.println(DateFormat.getDateInstance(DateFormat.LONG).
034 format(cal.getTime());
035 */
036 import java.text.DateFormat;
037 import java.util.Date;
038 public class DateUtils {
039 //public static String formatDateWithOptionalTime(Date date) {
040
041 public static String getDateString(Date date) {
042 //if (date.getHours() == 0 && date.getMinutes() == 0 && date.getSeconds() == 0)
043 // return DateFormat.getDateInstance(DateFormat.LONG).format(date);
044 return DateFormat.getDateInstance(DateFormat.LONG).format(date);
045 }
046 }