aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/utils/TimeUtils.java
blob: 7d281454edf79a62e2ccae1f74eae857da0eb0f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package org.onap.vid.utils;

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

public class TimeUtils {
    private static DateTimeFormatter formatter = DateTimeFormatter.RFC_1123_DATE_TIME;

    private TimeUtils() {
        // explicit private constructor, to hide the implicit public constructor
    }

    public static ZonedDateTime parseZonedDateTime(String time) {

        return ZonedDateTime.from(formatter.parse(time));
    }

    public static String zonedDateTimeToString(ZonedDateTime time) {
        return formatter.format(time);
    }
}