Wednesday, April 13, 2011

i came back into office for this? stupid longs

package com;

import java.util.Date;

public class D {
public static void main(String[] args) {
for (int i = 0; i < 40; i++) {
printDateInt(i);
printDateLong(i);
System.out.println();
}

long now = System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 30L;
System.out.println(new Date(now));

}

private static void printDateInt(int daysBack) {
long now = System.currentTimeMillis() - 1000 * 60 * 60 * 24 * daysBack;
System.out.println(daysBack + " " + new Date(now));
}

private static void printDateLong(long daysBack) {
long now = System.currentTimeMillis() - 1000 * 60 * 60 * 24 * daysBack;
System.out.println(daysBack + " " + new Date(now));
}
}