我正在使用碳,但试图获得本月的第一天,以便我可以从月初到当天运行报告。
$date = [
'start' => new \Carbon\Carbon('last month'),
'end' => new \Carbon\Carbon('today')
];
上述代码将显示今天的日期,回溯到上个月的同一天。但是我希望从1日到现在。
有一种简单的方法可以像上面那样做到这一点吗?无法在文档中找到任何内容。
答案 0 :(得分:91)
You can use following function
class OuterController extends PreloadedFX{
@FXML Pane rootPane;
@FXML Stuff otherStuffBoundInFXML;
@FXML AnchorPane innerContactPaneOne;
@FXML Checkbox importantCheckbox;
@FXML Label importantLabel;
// because of 'PrealoadedFX' getting called first,
// you can actually inline initialize object constants
// like this
private final ObservableBooleanValue isSelected = importantCheckbox.selectedProperty();
// or using an initializer
{
int x = 4;
importantLabel.setText(importantLable.getText() + x);
}
@Inject
public OuterController(InnerController inner, FXMLLoader loader){
super(loader);
innerContactPaneOne.getChildren().add(inner.getRootView());
}
}
class InnerController extends PreloadedFX{
@FXML Pane innerContentPaneTwo; //this will be a child of PaneOne in OuterController
@FXML Button otherStuff;
@Inject
public OuterController(FXMLLoader loader){
super(loader);
}
public Node getRootView(){
return innerContentPaneTwo;
}
}
//with somebody calling
OuterController rootController = injector.getInstance(OuterController.class);
答案 1 :(得分:42)