Here you can find the source of getHashByDay(String date)
public static int getHashByDay(String date)
//License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.TimeZone; import android.util.Log; public class Main{ private static final String TAG = "DateUtil"; private static SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); public static int getHashByDay(String date) { Date mDate = null;/*from w ww. j a va2s . c om*/ int dateInt = 0; Calendar cal = Calendar.getInstance(); if (date != null && !date.isEmpty()) { try { mDate = DateTimeUtil.stringToDate(date); } catch (ParseException e) { Log.e(TAG, "Unparsable date"); } } if (mDate != null) { cal.setTime(mDate); SimpleDateFormat dayFormat = new SimpleDateFormat("EEEE", Locale.US); SimpleDateFormat month_date = new SimpleDateFormat("MMMM"); int dayOfMonth = cal.get(Calendar.DAY_OF_YEAR); int thisYear = cal.get(Calendar.YEAR); dateInt = thisYear * 1000; dateInt += dayOfMonth; } return dateInt; } public static Date stringToDate(String date) throws ParseException { formatter.setTimeZone(TimeZone.getTimeZone("gmt")); return (formatter.parse(date)); } }