wood burning stoves
The moose likes Beginning Java and the fly likes Subtract Minutes from a DateTime object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Subtract Minutes from a DateTime object" Watch "Subtract Minutes from a DateTime object" New topic

Subtract Minutes from a DateTime object

Paul Fryer

Joined: Aug 13, 2007
Posts: 1
I have a datetime object and I want to subtract 30 minutes from it and be able to reference a datatime object with the 'new' datetime.

How do I do this?
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

A "datetime" object?

If this is Java you're asking about, then convert it to a Calendar object somehow (it isn't part of the standard Java API so you would have to find its documentation and read that). Thenand finally convert it somehow back to a datetime object.

If it's Javascript, then say so and a moderator will move the question to the Javascript forum.
pham thanh tung

Joined: Aug 15, 2011
Posts: 7
Thank you. I confused to set() function
Joanne Neal

Joined: Aug 05, 2005
Posts: 3742
If it's a Joda DateTime object you are talking about then look at the javadoc for it, specifically the minusXXX methods.

I agree. Here's the link: http://aspose.com/file-tools
subject: Subtract Minutes from a DateTime object
It's not a secret anymore!