thomaszhwang
asked on
What's the fastest way to change the time based on the following rule in Java?
If time is 4/19/2012 12:34:56, change the time to 4/19/2012 12:30:00.
If time is 4/19/2012 12:36:56, change the time to 4/19/2012 12:35:00.
So basically change the minute part to the last 5-minute time and remove the second.
In MySQL, it would be like:
If time is 4/19/2012 12:36:56, change the time to 4/19/2012 12:35:00.
So basically change the minute part to the last 5-minute time and remove the second.
In MySQL, it would be like:
DATE_SUB(DATE_SUB(aTime, INTERVAL MINUTE(aTime)%5 MINUTE), INTERVAL SECOND(aTime) SECOND)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER