aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Subtract Minutes from a DateTime object" Watch "Subtract Minutes from a DateTime object" New topic
Author

Subtract Minutes from a DateTime object

Paul Fryer
Greenhorn

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
Bartender

Joined: Oct 14, 2005
Posts: 18656
    
    8

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
Greenhorn

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

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


Joanne
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Subtract Minutes from a DateTime object