Here you can find the source of toStringForComparison(Date date)
Parameter | Description |
---|---|
date | the Date object |
public static String toStringForComparison(Date date)
//package com.java2s; /**//from ww w .j av a 2s . c o m * Copyright 5AM Solutions Inc, ESAC, ScenPro & SAIC * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/caintegrator/LICENSE.txt for details. */ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { /** * @param date the Date object * @return string date in "yyyy/MM/dd" format */ public static String toStringForComparison(Date date) { if (date == null) { return ""; } SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault()); return formatter.format(date); } }