• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Issue with Date objects

 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, I have this simple method converting String dates to Dates to Strings of another format. For some reason the final result is one date for both Strings. I want to understand what's happening in the method that causes such behavior. Much appreciated.
Output:
start: 01/30/2012 -->January 30, 2012
end: 09/30/2012 -->January 30, 2012

Method:
 
author
Posts: 23959
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

liliya woland wrote:Hi all, I have this simple method converting String dates to Dates to Strings of another format. For some reason the final result is one date for both Strings. I want to understand what's happening in the method that causes such behavior. Much appreciated.
Output:
start: 01/30/2012 -->January 30, 2012
end: 09/30/2012 -->January 30, 2012

Method:




Note: m = minutes
 
liliya woland
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, now I'm seeing more of the issue. This convertion of 09/30/2012 -->January 30, 2012 is happening regardless of having or not having another date. Hm...
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
to further emphasize Henry's point...

m is not the same thing as M.

Therefore, mm is not the same thing as MM.
 
liliya woland
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it, thanks a lot!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic