Set DateTimePicker value to be null

I think the best solution is to use the build-in checkbox that tell the user if a value is specified or not. Set the control property ShowCheckBox = true When you bind the value to it do something like if (value == DateTime.MinValue) { datePicker.Checked = false; } else { datePicker.Checked = true; datePicker.Value = … Read more

Get the value of bootstrap Datetimepicker in JavaScript

Either use: $(“#datetimepicker1”).data(“datetimepicker”).getDate(); Or (from looking at the page source): $(“#datetimepicker1”).find(“input”).val(); The returned value will be a Date (for the first example above), so you need to format it yourself: var date = $(“#datetimepicker1”).data(“datetimepicker”).getDate(), formatted = date.getFullYear() + “-” + (date.getMonth() + 1) + “-” + date.getDate() + ” ” + date.getHours + “:” + … Read more

DateTimePicker: pick both date and time

Set the Format to Custom and then specify the format: dateTimePicker1.Format = DateTimePickerFormat.Custom; dateTimePicker1.CustomFormat = “MM/dd/yyyy hh:mm:ss”; or however you want to lay it out. You could then type in directly the date/time. If you use MMM, you’ll need to use the numeric value for the month for entry, unless you write some code yourself … Read more

Is there any good and free Date AND Time Picker available for Java Swing? [closed]

For a time picker you can use a JSpinner and set a JSpinner.DateEditor that only shows the time value. JSpinner timeSpinner = new JSpinner( new SpinnerDateModel() ); JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, “HH:mm:ss”); timeSpinner.setEditor(timeEditor); timeSpinner.setValue(new Date()); // will only show the current time