I want to campare to dates from and to, but From EditText I am getting string and when I convert this to Date, it comes as miliseconds I want it in Date dd/mm/yyyy format.How can I achieve this.
Thanks, Sourabh On Fri, Oct 21, 2011 at 3:02 PM, midhun midhunvp <midhu...@gmail.com> wrote: > you can try this . It will work. > > fd = (EditText) findViewById(R.id.from_date); > td = (EditText) findViewById(R.id.to_date); > int MILLIS_IN_DAY = 1000 * 60 * 60 * 24; > Date date = new Date(); > SimpleDateFormat dateFormat = new > SimpleDateFormat("dd/MM/yyyy"); > String frommdate = > dateFormat.format(date.getTime()); > String nextDate = dateFormat.format(date.getTime() - > 7 > * (MILLIS_IN_DAY)); > fd.setText(nextDate); > td.setText(frommdate); > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en