package edu.wgu.d387_sample_code.Timezones;

import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

public class TimeConverter {
    public static String getTime(){

        //Let's get the current time
        ZonedDateTime now = ZonedDateTime.now();

        //Now let us covert to NY, UTC and MT

        //Easter Time
        ZonedDateTime et = now.withZoneSameInstant(ZoneId.of("America/New_York"));

        //Mountain Time
        ZonedDateTime mt = now.withZoneSameInstant(ZoneId.of("America/Denver"));

        // UTC time
        ZonedDateTime utc = now.withZoneSameInstant(ZoneId.of("UTC"));

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm a");

        // We are going to display this
        String displayTimes = et.format(formatter) + " ET / "  + mt.format(formatter) + " MT / " + utc.format(formatter) + " UTC";

        return displayTimes;
    }
}
