diff --git a/source/net/filebot/format/ExpressionFormatMethods.java b/source/net/filebot/format/ExpressionFormatMethods.java index 9205fefc..f6109bee 100644 --- a/source/net/filebot/format/ExpressionFormatMethods.java +++ b/source/net/filebot/format/ExpressionFormatMethods.java @@ -14,8 +14,10 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.attribute.BasicFileAttributeView; import java.nio.file.attribute.BasicFileAttributes; +import java.time.LocalTime; import java.time.format.DateTimeFormatter; import java.time.temporal.Temporal; +import java.time.temporal.TemporalAmount; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -551,7 +553,11 @@ public class ExpressionFormatMethods { } public static String format(Temporal self, String pattern) { - return DateTimeFormatter.ofPattern(pattern).format(self); + return DateTimeFormatter.ofPattern(pattern, Locale.ENGLISH).format(self); + } + + public static String format(TemporalAmount self, String pattern) { + return DateTimeFormatter.ofPattern(pattern, Locale.ENGLISH).format(LocalTime.MIDNIGHT.plus(self)); } /** diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index ce3c8e95..60f0bbbe 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -835,10 +835,7 @@ public class MediaBindingBean { @Define("hours") public String getHours() { - Duration d = getDuration(); - - // use RATIO instead of COLON for file name compatibility (see https://unicode-table.com/en/2236/) - return String.format("%d∶%02d", d.toHours(), d.minusHours(d.toHours()).toMinutes()); + return ExpressionFormatMethods.format(getDuration(), "H:mm"); } @Define("media")