-1

I am working with a Library slide Date Time Picker, It is giving me Date String a Jan 27 2016 02:29 PM... But I need Jan as 1, Feb as 2..etc I want Jan 27 2016 2:39PM as 1 27 2016 02:39PM

 private SimpleDateFormat mFormatter = new SimpleDateFormat("MMMM dd yyyy hh:mm aa");
  private TextView mButton;

   private SlideDateTimeListener listener = new SlideDateTimeListener() {

    @Override
    public void onDateTimeSet(Date date)
    {
        dateAndTime = mFormatter.format(date);
        mButton.setText(mFormatter.format(date));
    }

    // Optional cancel listener
    @Override
    public void onDateTimeCancel()
    {
        Toast.makeText(PutCredentials.this,
                "Canceled", Toast.LENGTH_SHORT).show();
    }
};
Arjun Singh
  • 724
  • 1
  • 8
  • 24
  • See @darshakat Ans: http://stackoverflow.com/questions/18480633/java-util-date-format-conversion-yyyy-mm-dd-to-mm-dd-yyyy – sivaBE35 Jan 27 '17 at 09:38

1 Answers1

4

Try new SimpleDateFormat("MM dd yyyy hh:mm aa") instead of new SimpleDateFormat("MMMM dd yyyy hh:mm aa")

beeb
  • 1,615
  • 1
  • 12
  • 24
Jay Patel
  • 319
  • 1
  • 8