Here you can find the source of timestampToDayNumber(long timestamp)
public static short timestampToDayNumber(long timestamp)
//package com.java2s; public class Main { public static short timestampToDayNumber(long timestamp) { long result = timestamp / (1000 * 60 * 60 * 24); if (result < 0 || result > Short.MAX_VALUE) { throw new IllegalArgumentException("Wrong date input '" + result + "'"); }//from w w w . jav a 2s . com return (short) result; } }