Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class Main {
    public static void main(String[] args) throws Exception {
        SimpleDateFormat broken = new SimpleDateFormat("kk:mm:ss");
        broken.setTimeZone(TimeZone.getTimeZone("Etc/UTC"));
        SimpleDateFormat working = new SimpleDateFormat("HH:mm:ss");
        working.setTimeZone(TimeZone.getTimeZone("Etc/UTC"));

        Date epoch = new Date(0);

        System.out.println(broken.format(epoch));
        System.out.println(working.format(epoch));
    }
}