Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Date & time operation  RSS feed

 
Mark Leong
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a date and time formatted as follows:-
Date = "2002-02-28"
Time = "14:15:00"
Date is formatted as yyyy-mm-dd and time is hh:mm:ss
How to add/minus X hours from the above date/time?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66040
140
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the Calendar and GregorianCalendar classes.
hth,
bear
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/Deprecation-Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!