Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { private static boolean isTheDayBeforeYesterDay(Calendar now, Calendar msg) { int nowDay = now.get(Calendar.DAY_OF_YEAR); int msgDay = msg.get(Calendar.DAY_OF_YEAR); return (nowDay - msgDay) == 2; } }