• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to subtract the date value  RSS feed

 
yoga babu
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai Friends,

I am having date&time like 06/19/2006 15:20:00 in my database.i m using these datas and generating reports using jsp.i want to subtract 15min from the actual data,

(06/19/2006 15:20:00) -(15min)

how to get it..pls help me

Regards
Yoga
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not related to servlets.
You can use SimpleDateFormat and Calendar to achieve this.
 
ak pillai
author
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something like ....


 
yoga babu
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,

Realy its very useful.Thanks for your time.again i am facing some problem,
i am trying to store the final value to string ,at the time i am facing this error

incompatible types
found : java.util.Date
required: java.lang.String
String ss=cal.getTime();(after subtracting 15min from input time)

How to store this final value in String.
Pls help me,

Thanks

Regards
Yogababu
 
Em Aiy
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String s = cal.getTime().toString();
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!