How to compare the time in two TimeStamp format?

    Calendar calendar = Calendar.getInstance();
    //Subtract 3 months from the current time. If it is a negative number, the year will be pushed forward. For example, January-3, 2010 will become October 2009
    calendar. add (Calendar.MONTH, -3 );
    Timestamp time = new Timestamp(calendar.getTimeInMillis());
    //Get the customer's last order time---orderTime
    CustomerOrder cusOrder = this .df.getCustomerOrderDao(). get (customerId);
    Timestamp orderTime = cusOrder.getTime();
    //Determine whether it has expired, true means more than 3 months
    if (time.after(orderTime)){

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *