本文整理匯總了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);
}