Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Dates parsing related

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a date sch_date_time=01/02/2014 08:00
and when i am doing SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy HH:mm");

date1 = sdf.parse(sch_date_time);

when i am printing date1 it is printing as Wed Jan 01 08:00:00 IST 2014,but it should be printed as Sat Feb 01...

please help me out guys what is the problem?


 
Marshal
Posts: 67275
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at your pattern. "mm" can't mean both minutes and month at the same time, can it?
 
srikanth darbha
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks bear for your quick response yes that is only the problem...

Bear Bibeault wrote:Look at your pattern. "mm" can't be mean both minutes and month at the same time, can it?

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!