Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DatePicker Widget Format

Tags:

android

I have defined a xml layout with the DatePicker widget as follows:

     <DatePicker 
        android:id="@+id/SelectDate"
        android:layout_marginTop="10dp"  
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:gravity="center|center_horizontal|center_vertical">
    </DatePicker>

and it is being displayed in mm/dd/yyyy format, as below:

alt text

but how can I display the DatePicker widget in (dd/mm/yyyy) format, as below?

alt text

like image 813
Paresh Mayani Avatar asked Dec 21 '10 12:12

Paresh Mayani


People also ask

What is DatePicker format?

By default, the date format of the jQuery UI Datepicker is the US format mm/dd/yy, but we can set it to a custom display format, eg: for European dates dd-mm-yyyy and so on. The solution is to use the date picker dateFormat option.

How do I change DatePicker format?

Do one of the following: For a text box control or a date picker control, ensure that the Data type list displays the appropriate data type, and then click Format. For an expression box control, ensure that the Format as list displays the appropriate data type, and then click Format.

How do I change DatePicker format from DD MM to YYYY?

The jQuery DatePicker plugin supports multiple Date formats and in order to set the dd/MM/yyyy Date format, the dateFormat property needs to be set. The following HTML Markup consists of a TextBox which has been made Read Only.

How do I change my DatePicker size?

By default DatePicker has standard height and width (height: '30px' and width: '143px'). You can change this height and width by using height and width property respectively.


2 Answers

The picker take the date format chosen by the user, which means you don't really have to format it, as probably the user enjoyes the most to see the format he's used to.

I've just tested the HelloDatePicker tutorial and in my phone, I have the date in (dd/mm/yyyy) format, so the picker shows the same format; in emulator, I've put the date in mm/dd/yyyy format, so the picker displays the same.

According to this answer there is no method to set the display format.

like image 52
Adinia Avatar answered Oct 27 '22 21:10

Adinia


In android native datepicker will not allow you to change theme and sequence of picker of it at all.

You should try custom date picker component for that because no choice for that.

see this question How do you use custom Datepicker and Timepicker skins? for custom datepicker.You will get answer for custom picker component in that you can customize all the things with theme and sequence of format also.

like image 20
Bhavesh Hirpara Avatar answered Oct 27 '22 20:10

Bhavesh Hirpara