android - Date format in Java not parsing -


i want know how can format date in java. have following code,

string enddate = textenddate.gettext().tostring();                 log.d(tag, "date enddate");                  log.d("adebugtag", "value: " + textenddate.gettext());                 // = "03/26/2012 11:49:00 am";                 simpledateformat dateformat = new simpledateformat("dd-mm-yyyy");               //  date converteddate = new date();                 try {                     actualenddate = dateformat.parse(enddate);                     log.d("adebugtag", "value actualendate: " + actualenddate.tostring());                 } catch (parseexception e) {                     // todo auto-generated catch block                     e.printstacktrace();                 } 

logcat follows.

05-31 18:54:24.651: d/newbet(17235): date enddate 05-31 18:54:24.651: d/adebugtag(17235): value: 2015-07-30 05-31 18:54:24.661: d/adebugtag(17235): value actualendate: thu jan 05 00:00:00 gmt+08:00 36 05-31 18:54:24.661: d/newbet(17235): oncreate() restoring previous state 05-31 18:54:24.681: d/libc(17235): [net] getaddrinfo+,hn 13(0x6170692e706172),sn(),family 0,flags 4 05-31 18:54:24.681: d/libc(17235): [net] getaddrinfo-,err=8 05-31 18:54:24.681: d/libc(17235): [net] getaddrinfo+,hn 13(0x6170692e706172),sn(),family 0,flags 1024 05-31 18:54:24.681: d/libc(17235): [net] getaddrinfo-, 1 05-31 18:54:24.681: d/libc(17235): [net] getaddrinfo_proxy+ 05-31 18:54:24.731: d/libc(17235): [net] getaddrinfo_proxy-, success 05-31 18:54:24.731: i/global(17235): call createsocket() return new socket. 05-31 18:54:24.731: d/libc(17235): [net] getaddrinfo+,hn 13(0x35342e3136342e),sn(),family 0,flags 4 05-31 18:54:24.731: d/libc(17235): [net] getaddrinfo-, success 05-31 18:54:26.113: d/libc(17235): [net] getaddrinfo+,hn 13(0x6170692e706172),sn(),family 0,flags 4 05-31 18:54:26.113: d/libc(17235): [net] getaddrinfo-,err=8 

your enddate 2015-07-30. need use matching format.

simpledateformat dateformat = new simpledateformat("yyyy-mm-dd"); 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -