Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Calendar;

import java.util.TimeZone;

public class Main {
    public static final long MILLISECONDS_PER_DAY = 1000L * 3600 * 24;

    public static Calendar calendarFromDays(long days) {
        return calendarLocal_FromMilliseconds(days * MILLISECONDS_PER_DAY - TimeZone.getDefault().getRawOffset());
    }

    public static Calendar calendarLocal_FromMilliseconds(long msUTC) {
        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(msUTC);
        return c;
    }
}