Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Datetimepicker to Month and Year only format?

Tags:

How can I set the Datetimepicker-Format to MM/YYYY?

like image 295
asdasdad Avatar asked Apr 13 '12 07:04

asdasdad


People also ask

How do you only show month and year in date picker?

Set changeMonth and changeYear to true so that Month and Year appear as Dropdown. Set date format to "MM yy". jQuery DatePicker has "onClose" event, which is called when Datepicker gets closed. So using this event, fetch the selected Month and Year and setDate of Datepicker.

What is DateTimePicker (); in JS?

The JavaScript DateTime Picker is a lightweight and mobile-friendly control that allows end users to enter or select date and time values from a pop-up calendar and drop-down time list. It provides month, year, and decade views for quick navigation to the desired date.

How do I add date and time picker?

If the Controls task pane is not visible, click More Controls on the Insert menu, or press ALT+I, C. Under Insert controls, click Date Picker. In the Date Picker Binding dialog box, select the field in which you want to store the date picker data, and then click OK.


1 Answers

Use DateTimerPicker.Format property. Check MSDN

public void SetMyCustomFormat() {    // Set the Format type and the CustomFormat string.    dateTimePicker1.Format = DateTimePickerFormat.Custom;    dateTimePicker1.CustomFormat = "MM/yyyy"; } 
like image 122
ABH Avatar answered Oct 07 '22 01:10

ABH