• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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: 23951
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: 13089
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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic