How to get datepicker value in date format?

后端 未结 5 1031
礼貌的吻别
礼貌的吻别 2021-02-08 05:55

I have a problem with my Datapicker

i use the code for getting date,month & year shown below

           DatePicker datePicker;
           datePicker         


        
5条回答
  •  执笔经年
    2021-02-08 06:09

     public String checkDigit(int number)
        {
            return number<=9?"0"+number:String.valueOf(number);
        }
    

    basic use:

    month=checkDigit(month);
    input 7
    output 07
       String date=checkDigit(monthOfYear+1)+"/"+checkDigit(dayOfMonth)+"/"+year;
    

提交回复
热议问题