// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class TimeFun2 {
    private DateFormat dfUTC;
    private DateFormat dfLocal;
    public TimeFun2() {
        dfUTC = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
        dfUTC.setTimeZone(TimeZone.getTimeZone("UTC"));
        dfLocal = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
        dfLocal.setTimeZone(TimeZone.getDefault());
    }
    public String format(DateUTC d) {
        return dfUTC.format(d);
    }
    public String format(DateLocal d) {
        return dfLocal.format(d);
    }
    public static void main(String[] args) {
        DateUTC d1 = new DateUTC();
        DateLocal d2 = new DateLocal();
        TimeFun2 fmt = new TimeFun2();
        System.out.println(fmt.format(d1));
        System.out.println(fmt.format(d2));
    }
}

class DateUTC extends Date {
}

class DateLocal extends Date {
}
