// 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 TimeFun1 {
    private DateFormat dfUTC;
    private DateFormat dfLocal;
    public TimeFun1() {
        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 formatUTC(Date d) {
        return dfUTC.format(d);
    }
    public String formatLocal(Date d) {
        return dfLocal.format(d);
    }
    public static void main(String[] args) {
        Date d = new Date();
        TimeFun1 fmt = new TimeFun1();
        System.out.println(fmt.formatUTC(d));
        System.out.println(fmt.formatLocal(d));
    }
}
