本文整理汇总了Java中java.time.LocalTime.format方法的典型用法代码示例。如果您正苦于以下问题:Java LocalTime.format方法的具体用法?Java LocalTime.format怎么用?Java LocalTime.format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.time.LocalTime
的用法示例。
在下文中一共展示了LocalTime.format方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isTimeToRun
import java.time.LocalTime; //导入方法依赖的package包/类
public boolean isTimeToRun () {
if ( getFrequency().trim().equals( "hourly" ) ) {
return true;
} else if ( getFrequency().trim().equals( "daily" ) ) {
LocalTime currentTime = LocalTime.now(); // current time
String currentHour = currentTime.format( DateTimeFormatter.ofPattern( "HH" ) );
if ( currentHour.matches( getHour() ) ) {
return true;
}
}
return false;
}
示例2: TimeScaleViewSkin
import java.time.LocalTime; //导入方法依赖的package包/类
public TimeScaleViewSkin(T view) {
super(view);
LocalTime time = LocalTime.of(1, 0);
for (int i = 1; i < 24; i++) {
Label label = new Label(time.format(formatter));
label.setManaged(false);
label.setMaxWidth(Double.MAX_VALUE);
label.setAlignment(Pos.CENTER_RIGHT);
label.getStyleClass().add("time-label"); //$NON-NLS-1$
label.setTextOverrun(OverrunStyle.CLIP);
labels.add(label);
getChildren().add(label);
time = time.plusHours(1);
}
currentTimeLabel = new Label();
currentTimeLabel.getStyleClass().add("current-time-label"); //$NON-NLS-1$
currentTimeLabel.setManaged(false);
currentTimeLabel.setMaxWidth(Double.MAX_VALUE);
currentTimeLabel.setAlignment(Pos.CENTER_RIGHT);
currentTimeLabel.setOpacity(0);
currentTimeLabel.setTextOverrun(OverrunStyle.CLIP);
currentTimeLabel.visibleProperty().bind(view.enableCurrentTimeMarkerProperty());
getChildren().add(currentTimeLabel);
updateCurrentTimeMarkerVisibility();
view.showCurrentTimeMarkerProperty().addListener(
it -> updateCurrentTimeMarkerVisibility());
setupCurrentTimeMarkerSupport();
updateShowMarkers();
}
示例3: timeRangeFormat
import java.time.LocalTime; //导入方法依赖的package包/类
private String timeRangeFormat(LocalTime timePart) {
LocalTime timePart2 = timePart.plus(30, ChronoUnit.MINUTES);
return timePart.format(dtf) + " - " + timePart2.format(dtf);
}
示例4: printTime
import java.time.LocalTime; //导入方法依赖的package包/类
public static String printTime(LocalTime time) {
return time.format(timePrintFormatter);
}