mirror of https://github.com/micromata/borgbackup-butler.git

...
Kai Reinhard
16.52.2018 78d82418ff8fa4212dbdeec904512092f1a5ac67
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package de.micromata.borgbutler.utils;
 
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
 
public class DateUtils {
    private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
    /**
     * @param borgDateTime
     * @return
     */
    public static String format(String borgDateTime) {
        if (borgDateTime == null) {
            return null;
        }
        LocalDateTime dateTime = LocalDateTime.parse(borgDateTime);
        return format(dateTime);
    }
 
    /**
     * @param dateTime
     * @return
     */
    public static String format(LocalDateTime dateTime) {
        return dateTime.format(DATE_TIME_FORMATTER);
    }
}